0

我正在尝试在 Windows 8 上执行 openCV 代码,它显示 Not Responding Windows。我正在使用以下代码:

#include <iostream>
#include<opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
using namespace std;

int main() {
cout << "!!!Hello World !!!" << endl; // prints !!!Hello World!!!
cvNamedWindow( "abc", 1 );
IplImage* img = cvLoadImage( "C:\\Users\\****\\Pictures\\123.jpg" );
 cvShowImage( "abc", img );
 while( 1 ) {
     if( cvWaitKey( 100 ) == 27 ) break;
   }

 cvDestroyWindow( "abc" );
   cvReleaseImage( &img );

return 0;
}

当我执行上述代码时,出现以下错误:

Windows 没有响应。

其他信息:

操作系统:Windows8 IDE:EClipse openCV Vesion 2.4.0 c++ 编译器:MinGW

如果需要更多额外信息,请告诉我。

4

1 回答 1

0

尝试

bool stop = 0;
while( !stop) {
    if( cvWaitKey( 100 ) == 27 ) stop=1;
}

在调试模式下会发生什么?展开 if 语句并放置一个 cout << "exit"; 在中,添加一个断点,然后单步执行。找出它停止响应的位置。

于 2013-02-27T22:06:43.563 回答