convert the image to double before computation

Signed-off-by: Chris Cheung <chriscsc@me.com>