From a63a44e6fdf07ce9f3e02a57baff2e76943fd15e Mon Sep 17 00:00:00 2001 From: lazywei Date: Mon, 16 Dec 2013 12:17:24 +0800 Subject: [PATCH] Fix ratio computing error. --- opencv/imgproc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opencv/imgproc.go b/opencv/imgproc.go index 56d82ee..07c4993 100644 --- a/opencv/imgproc.go +++ b/opencv/imgproc.go @@ -20,12 +20,12 @@ func Resize(src *IplImage, width, height, interpolation int) *IplImage { panic("Width and Height cannot be 0 at the same time") } if width == 0 { - ratio := float64(height / src.Height()) + ratio := float64(height) / float64(src.Height()) width = int(float64(src.Width()) * ratio) log.Println(ratio) log.Println(width) } else if height == 0 { - ratio := float64(width / src.Width()) + ratio := float64(width) / float64(src.Width()) height = int(float64(src.Height()) * ratio) log.Println(ratio) log.Println(height)