我是 OpenCV 的初学者。我的编程环境是 VC++ Express 2010 + OpenCV 2.4.2 + Win 7 64 位。
我在我的 VC++ 和 Path 中使用纯 32 位配置。
我输入以下代码:
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\core\core.hpp"
using namespace cv;
int main(int argc, char** argv) {
char* imgPath = "logo.png";
Mat img = imread(imgPath);
namedWindow( "Example1", WINDOW_AUTOSIZE);
imshow("Example1", img);
waitKey(0);
return 0;
}
然后我编译并运行。它确实提出了一个窗口(但没有图片),但后来给了我这个(运行时错误?)
Unhandled exception at 0x770515de in Helloworld2.exe: Microsoft C++ exception: cv::Exception at memory location 0x001ef038..
然后我将 imread 更改为 cvLoadImage 并且它可以正常工作。
有人可以告诉我有什么问题吗?