【发布时间】:2017-04-23 16:05:27
【问题描述】:
我安装了 OpenCV 2.4.10 并将其配置到我的 Visual Studio 2010。甚至我在 opencv(c) 中运行以下代码
我在 opencv 中的代码:
#include "opencv\highgui.h"
int main(int argc, char** argv)
{
IplImage* img =cvLoadImage("d:\\1.jpg",CV_WINDOW_AUTOSIZE);
cvNamedWindow("example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Exame1");
}
它可以工作,但是当我尝试使用此处给出的代码时,使用 opencv2(c++) 但它给出了错误(中断)
我在opencv2中的代码:
#include "opencv2\opencv.hpp"
using namespace cv;
int main()
{
Mat image = imread("d:\\1.jpg", CV_LOAD_IMAGE_COLOR);
namedWindow("test", WINDOW_AUTOSIZE);
imshow("test", image);
waitKey(0);
return 0;
}
错误(中断):
o.exe 中 0x7624c41f (KernelBase.dll) 处未处理的异常:Microsoft C++ 异常:cv::Exception at memory location 0x0035f63c..
为什么这个错误只是在opencv2中?!
我想使用 opencv2
【问题讨论】: