Tubbs
Tubbs

Reputation: 715

Take OpenCV window and make full screen

I am currently making an OpenCV project in C++ where I look for motion with a kinect and use that to cue a slideshow (sans recognition). Currently, I am displaying the slideshow using OpenCV (as I've only had about a week to whip this up). It looks good and its quick. The only problem is that this is going to be on display for a big production and I can't really afford to have the window showing (I'm talking window decorations like the title bar and such).

I need to get rid of the title bar. I've done a lot of research, and I have found out that you can magically grab the window handle by calling cvGetWindowHandle("SlideShow"), but that is a void function, so I don't really know how I am supposed to get a handle from that to manipulate.

I'm developing this for both windows AND ubuntu, since it will end up on a windows machine, but I can only demo on a laptop running ubuntu.

If anyone can tell me how to take the window and render it fullscreen with a resized image to fill most if not the entire screen in either Windows or Ubuntu, I will be forever grateful.

Upvotes: 19

Views: 49593

Answers (3)

Amin Ya
Amin Ya

Reputation: 1948

In opencv/4.5.1, this is how it is done:

    namedWindow("Name", WINDOW_NORMAL);
    setWindowProperty ("Name", WND_PROP_FULLSCREEN, WINDOW_FULLSCREEN);

Assuming you have added using namespace cv;

Upvotes: 2

Aras
Aras

Reputation: 5926

I am using OpenCV 2.1 on Ubuntu 11.04. On my system CV_WINDOW_FULLSCREEN and CV_WINDOW_AUTOSIZE flags both map to 1 And both flags behave exactly the same. They give you a fixed size window, which would be expected for AUTOSIZE flag but not the FULLSCREEN. I think these two flags are meant for different functions although their simillar appearance is very confusing. The flag CV_WINDOW_NORMAL maps to value 0 which is what you have used. It gives you a resizable window that you could maximize, but it is not a fullscreen window.

Edit: I just found the solution in another stachoverflow post. Here is the solution from that post which worked great on my system:

    cvNamedWindow("Name", CV_WINDOW_NORMAL);
    cvSetWindowProperty("Name", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
    cvShowImage("Name", your_image);

I get a real fullscreen with no title bar etc.

Upvotes: 27

cordellcp3
cordellcp3

Reputation: 3623

you can use the cv::setWindowProperty function for your purpose, just set it to CV_WINDOW_FULLSCREEN.

Full documentation in the openCV-WIKI

Upvotes: 3

Related Questions