简体   繁体   中英

Unhandled exception at project in opencv

I am trying to compile a opencv project from visual studio 2010. I ve already created in vs2008, but I want to it compile it also from vs2010. I put all dependecies and includes, however during the running process I am receiving the following message:

Unhandled exception at 0x7c812fd3 in myProject.exe: Microsoft C++ exception: cv::Exception at memory location 0x0011fa60..

My source code its just an imread function. So it has to be something from the installation process in opencv in vs2010.

In debug I am receiving in modules: opencv_highgui246.dll cannont fild or open the PDB file. EDIT:

My code:

    try{
Mat A;
Mat D (A, Rect(10, 10, 100, 100) ); 
imshow( "Display window", D );  
waitKey(0);
}

catch (cv::Exception& e) {
cout << e.what() << endl;
}

And what I am receiving

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.widt
h <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in
unknown function, file .\src\matrix.cpp, line 323
.\src\matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.
width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows

EDIT2:

I ve change the code:

    try{
Mat image = imread("8516.jpg", 1);
imshow( "Display window", image );  
waitKey(0);
}

catch (cv::Exception& e) {
cout << e.what() << endl;
}

Now I am just receiving the unhandled error.

Thanks for the edit, clearly, the problem is with the code,

what do you want to crop from "A", when there is nothing in it, load an image before doing it.

Mat A = imread("something.jpg");
Mat D (A, Rect(10, 10, 100, 100) ); 
imshow( "Display window", D );  

Have you tried catching that exception?

try {
// Your code.
}
catch (cv::Exception& e) {
    cout << e.what() << endl;
}

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