Ask Your Question
0

Resize Image

asked 2016-06-10 06:44:40 -0600

kevgeo gravatar image

I want to resize my image into half but the output is wrong as it is just showing a part of the image; it doesn't resize the whole image into half. The code used is below-

Mat src;
src = imread( "cameraman.tif" );
Mat img_resize;
resize(src,img_resize,Size(src.rows/2,src.cols/2)) ;

Original Image and Output-Image

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-10 06:51:07 -0600

LBerger gravatar image

updated 2016-06-10 07:32:41 -0600

Size is defined by width and height (not like your example you use row(height) and column (width)

In resize doc you can find your answer

if you want to decimate the image by factor of 2 in each direction, you can call the function this way:

// specify fx and fy and let the function compute the destination image size.

resize(src, dst, Size(), 0.5, 0.5, interpolation);

edit flag offensive delete link more

Comments

Thanks LBerger, it works now. I also understood what you were trying to say earlier. Thanks once again.

kevgeo gravatar imagekevgeo ( 2016-06-10 07:27:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-10 06:44:40 -0600

Seen: 949 times

Last updated: Jun 10 '16