简体   繁体   English

OpenCV imshow() 不起作用

[英]OpenCV imshow() does not work

I have written an openCV code and my code has following statement:我写了一个 openCV 代码,我的代码有以下语句:

cv::imshow("Matches", matchesImg);
cv::waitKey(0);

When I run the code either in Debug or Release I am not able to see window which shows me the output.当我在 Debug 或 Release 中运行代码时,我看不到显示输出的窗口。

And this is happening for every project I create.这发生在我创建的每个项目中。

Not able to figure out the reason, Can someone please guide me on this?无法弄清楚原因,有人可以指导我吗?

I am coding on Windows 7 and Visual studio 2010, with opencv version of 2.4.6我在 Windows 7 和 Visual Studio 2010 上编码,opencv 版本为 2.4.6

As I mentioned in the comments, you have to create a window first, using namedWindow with the same window name as in imshow See this tutorial for details.正如我在评论中提到的,您必须首先创建一个窗口,使用与namedWindow窗口名称相同的imshow详情请参阅本教程

EDIT编辑

This strongly suggest that you have to create the window beforehand. 强烈建议您必须事先创建窗口。 Some may argue that it didn't work this way for previous versions of OpenCV.有些人可能会争辩说,它不适用于以前版本的 OpenCV。 Then, let's say this solution apply at least to OpenCV 2.4.6, which is the version of concern here (and it solved the problem).然后,假设这个解决方案至少适用于 OpenCV 2.4.6,这是这里关注的版本(它解决了问题)。

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

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