简体   繁体   中英

OpenCv_ unhandle exception in load image with opencv2

I installed OpenCV 2.4.10 and configured it to my Visual Studio 2010. And even I run below code in opencv(c)

My code in 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");
}

and it works but when I try to use the code given here,with opencv2(c++) but it gives an error (break)

My code in 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;
}

Error(break):

Unhandled exception at 0x7624c41f (KernelBase.dll) in o.exe: Microsoft C++ exception: cv::Exception at memory location 0x0035f63c..

Why is this error just in opencv2?!

I want to work with opencv2

您将必须根据所使用的opencv .dll文件的构建信息来验证是否在调试/发布模式下进行构建。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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