Ask Your Question

How can I fit a small image frame to a bigger window size?

asked 2013-06-21 20:05:57 -0500

kpcamota gravatar image

I managed to scaled down a 640x480 pixels to 8x4 using the cv::Resize function, but as expected it will display a 8x4 window size right?

Now, I resized the window to a bigger size, but the image is still at 8x4pixels. I want it to fit on the bigger size.

Check my code below. image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-22 03:54:26 -0500

Notas gravatar image

Resizewindow only changes the size of the displaying window, not the image that it displays. If you want to resize the image, call resize again with your size variable modified to the new dimensions. Although I fail to see the reason behind that... increasing an image from 8x4 to 260x150 and changing the aspect ratio.

edit flag offensive delete link more


this for the display purposes only. I just want the 8x4pixels to be shown on a bigger window. So there is no other way I can achieve this?

kpcamota gravatar imagekpcamota ( 2013-06-22 09:56:08 -0500 )edit

NOW I understand your problem... you used the methods in the wrong order. First, you declare your window with cvNamedWindow, then you use ShowImage and after that resize (or before, doesn't matter). The important thing is to always use namedwindow first.

Notas gravatar imageNotas ( 2013-06-22 11:10:48 -0500 )edit

THANK YOU SO MUCH! It works. :)

kpcamota gravatar imagekpcamota ( 2013-06-22 11:44:29 -0500 )edit

Glad to hear it. Then please accept the answer by clicking on the check sign on the left side of my answer :)

Notas gravatar imageNotas ( 2013-06-22 12:15:06 -0500 )edit

Question Tools


Asked: 2013-06-21 20:05:57 -0500

Seen: 1,291 times

Last updated: Jun 22 '13