简体   繁体   English

无法在 openCV 中显示图像显示 windows

[英]Can't show image display windows in openCV

I am using openCV python bindings.我正在使用 openCV python 绑定。 I am trying to show the output image using the following listing:我正在尝试使用以下清单显示 output 图像:

cv.NamedWindow('display')
cv.MoveWindow('display', 10, 10)
cv.ShowImage('display', cvImage)

But I do not see any window.但我没有看到任何 window。

My platform is Linux (openSuse 11.4), python-opencv version 2.1 and python 2.7.我的平台是 Linux(openSuse 11.4),python-opencv 版本 2.1 和 python 2.7。

You need to call the WaitKey function to process the events.您需要调用 WaitKey function 来处理事件。 Check out the documentation: http://opencv.willowgarage.com/documentation/python/highgui_user_interface.html#waitkey查看文档: http://opencv.willowgarage.com/documentation/python/highgui_user_interface.html#waitkey

This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing, unless HighGUI is used within some environment that takes care of event processing.这个 function 是 HighGUI 中唯一可以获取和处理事件的方法,因此需要定期调用它来进行正常的事件处理,除非在某些负责事件处理的环境中使用 HighGUI。

Just add a WaitKey(0) at the end of your code and it should work just fine.只需在代码末尾添加一个 WaitKey(0) 就可以了。

in addition to this information: WaitKey(1) does not wait for 1ms but for at least 15ms...you can measure that if you want.除此信息外:WaitKey(1) 不会等待 1 毫秒,而是至少等待 15 毫秒……您可以根据需要进行测量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM