OpenCV cvNamedWindow 未出现在 Fedora 下
正如标题所示,我只是想打开一个命名窗口。我使用 OpenCV 已经一年多了,以前从未遇到过这个问题。由于某种原因,窗口永远不会打开。我尝试运行一些旧脚本,一切正常。
作为一个非常精简的示例,请参见下面,
#include "cv.h"
#include "highgui.h"
int main(int argc, char** argv) {
cvNamedWindow( "video", 0 );
IplImage *im = cvCreateImage( cvSize(200,200), 8, 3 );
while(1) {
cvShowImage( "video", im );
}
return 0;
}
我看不出为什么这不起作用,但由于某种原因,窗口永远不会出现。 还有其他人经历过吗?它让我头疼!
As the title suggests I'm simply trying to get a named window to come up. I've been working with OpenCV for over a year now, and never had this problem before. For some reason, the window never opens. I've tried running some of my old scripts and everything works fine.
As a very cut down example, see below
#include "cv.h"
#include "highgui.h"
int main(int argc, char** argv) {
cvNamedWindow( "video", 0 );
IplImage *im = cvCreateImage( cvSize(200,200), 8, 3 );
while(1) {
cvShowImage( "video", im );
}
return 0;
}
I can see no reason why that wouldn't work, but for some reason the window never appears.
Has anyone else experienced this? It's doing my head in!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在循环中调用
cvWaitKey(int milliseconds)
即可。该函数通知GUI系统运行图形待处理事件。你的代码应该是这样的:
Simply call
cvWaitKey(int milliseconds)
within the loop. This function notifies the GUI system to run graphics pending events.Your code should be something like: