获取OpenCV窗口并使其全屏

发布于 2024-10-31 11:32:59 字数 450 浏览 5 评论 0原文

我目前正在用 C++ 制作一个 OpenCV 项目,在其中我使用 kinect 寻找运动并使用它来提示幻灯片(无识别)。目前,我正在使用 OpenCV 来显示幻灯片(因为我只有大约一周的时间来完成它)。它看起来不错而且速度很快。唯一的问题是,这将在大型制作中展示,而我真的负担不起展示窗口(我说的是诸如标题栏之类的窗口装饰)。

我需要去掉标题栏。我做了很多研究,我发现你可以通过调用 cvGetWindowHandle("SlideShow") 神奇地抓住窗口句柄,但这是一个空函数,所以我真的不知道我应该如何做从中获取一个句柄来进行操作。

我正在为 Windows 和 ubuntu 开发这个,因为它最终会在 Windows 机器上运行,但我只能在运行 ubuntu 的笔记本电脑上演示。

如果有人能告诉我如何在 Windows 或 Ubuntu 中使用调整大小的图像来全屏渲染窗口,以填充大部分(如果不是整个屏幕),我将永远感激不已。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我也只是我 2024-11-07 11:32:59

我在 Ubuntu 11.04 上使用 OpenCV 2.1。在我的系统上,CV_WINDOW_FULLSCREEN 和 CV_WINDOW_AUTOSIZE 标志都映射为 1
两个标志的行为完全相同。它们为您提供了一个固定大小的窗口,这是 AUTOSIZE 标志所期望的,但不是全屏。我认为这两个标志具有不同的功能,尽管它们相似的外观非常令人困惑。标志 CV_WINDOW_NORMAL 映射到您所使用的值 0。它为您提供了一个可以最大化的可调整大小的窗口,但它不是全屏窗口。

编辑:我刚刚在另一篇stachoverflow帖子中找到了解决方案。这是该帖子中的解决方案,在我的系统上效果很好:

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

我得到了一个真正的全屏,没有标题栏等。

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.

找回味觉 2024-11-07 11:32:59

您可以使用 cv::setWindowProperty 函数来实现您的目的,只需将其设置为 CV_WINDOW_FULLSCREEN 即可。

openCV-WIKI 中的完整文档

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

Full documentation in the openCV-WIKI

一片旧的回忆 2024-11-07 11:32:59

在 opencv/4.5.1 中,它是这样完成的:

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

假设您添加了 using namespace cv;

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;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文