Ask Your Question
3

Making a window full screen keeping aspect ratio

asked 2012-07-20 18:59:12 -0600

Tsuyoshi gravatar image

updated 2012-07-25 02:39:34 -0600

Kirill Kornyakov gravatar image

I am trying to make a window full screen keeping its aspect ratio by the following code:

  cvNamedWindow(win_title, CV_WINDOW_NORMAL);
  cvSetWindowProperty(win_title, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
  cvSetWindowProperty(win_title, CV_WND_PROP_ASPECTRATIO, CV_WINDOW_KEEPRATIO);

but it does not keep the aspect ratio when it comes to full screen. Full-screen succeeded but keeping aspect ratio did not work. Any suggestions? (using opencv 2.4.2 windows binary distribution on Windows 7)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-07-23 04:48:05 -0600

XCoder gravatar image

I'm not sure if this will work and I don't have Qt compiled at this moment but try something like this:

cvNamedWindow( win_title, CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO );

Without Qt, when I maximized the window, the image kept it's size and aspect ratio.

Check these two documentation about windows:

edit flag offensive delete link more

Comments

1

It does not seem to come to full screen as far as CV_WINDOW_AUTOSIZE is set. Thanks anyway. Actually, I made the aspect ratio of my image by adding black margin to its sides, and it's working now without any help by the property things mentioned above.

Tsuyoshi gravatar imageTsuyoshi ( 2012-07-24 20:50:49 -0600 )edit

hi tsuyoshi, can you post your solution ?

refuzee gravatar imagerefuzee ( 2013-09-17 06:12:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-07-20 18:59:12 -0600

Seen: 10,882 times

Last updated: Jul 25 '12