OpenCV 窗口始终位于顶部
有没有办法将 OpenCV 窗口设置为始终位于顶部? 我可以从窗口中删除最小化和关闭按钮吗? 谢谢。
Is there a way to set a OpenCV window to be always on top?
And can i remove the minimize and close button from my window?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以使用:
cvGetWindowHandle()
获取 Widows 处理程序。然后使用常规的 Windows API 你可以做任何你喜欢的事情
You can use:
cvGetWindowHandle()
to obtain Widows handler. Then using regular windows API you can do anything you like
您可以使用 setWindowProperty
使用属性
WND_PROP_TOPMOST
在顶部设置 OpenCV 窗口。这适用于OpenCV 3.4.8+和4.1.2+。
例如在 python 中:
上面的 python 代码应该创建一个前台窗口:
You can use setWindowProperty
to set an OpenCV window on top with the property
WND_PROP_TOPMOST
.This works with OpenCV 3.4.8+ and 4.1.2+.
E.g. in python:
The above python code should create a foreground window:
我在此处的评论中找到了最佳解决方案: Python OpenCV在其他应用程序之上打开窗口
只需在打开窗口后添加以下命令,例如
使用小写的“python”。正如我在一些答案中发现的那样,使用“Python”给了我一个错误:
I found the best solution posted in comments here: Python OpenCV open window on top of other applications
Simply add the command below after opening a window, e.g.
Use "python" in lower case. Using "Python", as I found in some answers, gave me an error:
我发现我需要做的就是将主窗口设置为全屏,然后恢复正常。
I found that all I needed to do was set my main window to fullscreen then back to normal.
我发现,对于任何回顾过去的人来说,解决这个问题的最简单方法就是这两行。这就像 Gugile 的另一个答案一样,但不需要先用单独的行创建命名窗口。
The simplest way I found to solve this for anyone looking back was just these two lines. It's like the other answer by Gugile but there's no need to have a seperate line creating the named window first.
对我来说,这在 macOS 中工作得很好,我认为它在另一个操作系统中也能很好地
重复循环,顺序是:
位置
for me this work fine in macOS, I think that it's will work well in another os
this repeat in loop, the sequence are:
position