I tried some variations but it seem that resizeWindow don't do anything. I give simple code example,the result is that the 2 windows are in the same size , eventough it supposed to be in different sizes.
Mat m = imread("somePath",CV_LOAD_IMAGE_COLOR);
namedWindow("aa",CV_WINDOW_NORMAL);
namedWindow("bb",CV_WINDOW_NORMAL);
imshow("aa",m);
imshow("bb",m);
resizeWindow("aa",400,400);
resizeWindow("bb",800,800);
waitKey(0);
I work with eclipse-cdt on ubunto 12.04 with opencv 2.4.3.
The following code snippet works for me:
namedWindow("Final", 0);
resizeWindow("Final", 500,500);
"Only windows created without CV_WINDOW_AUTOSIZE flag can be resized."
REF: http://docs.opencv.org/modules/highgui/doc/user_interface.html#resizewindow
Make sure that OpenCV is installed with Qt backend support.
Quote from the documentation of namedWindow()
(emphasis is mine):
flags – Flags of the window. Currently the only supported flag is CV_WINDOW_AUTOSIZE. If this is set, the window size is automatically adjusted to fit the displayed image (see imshow() ), and you cannot change the window size manually.
...
Note: Qt backend supports additional flags: CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE: CV_WINDOW_NORMAL enables you to resize the window, whereas CV_WINDOW_AUTOSIZE adjusts automatically the window size to fit the displayed image (see imshow() ), and you cannot change the window size manually.
It is likely that CV_WINDOW_AUTOSIZE
is the only supported flag on your system. Documentation for resizeWindow
says that only windows created without CV_WINDOW_AUTOSIZE
flag can be resized. Your options are:
resize()
function to resize the image before displaying it.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With