Ask Your Question
3

Making a window full screen keeping aspect ratio

asked Jul 21 '12

Tsuyoshi gravatar image

updated Jul 25 '12

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)

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jul 23 '12

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:

Preview: (hide)

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 (Jul 25 '12)edit

hi tsuyoshi, can you post your solution ?

refuzee gravatar imagerefuzee (Sep 17 '13)edit

Question Tools

1 follower

Stats

Asked: Jul 21 '12

Seen: 11,141 times

Last updated: Jul 25 '12