Ask Your Question
0

Unhandled exception at 0x00007FFB8B3F9159 in test1.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000A35178F4E0.

asked 2020-03-13 15:37:49 -0600

updated 2020-03-13 15:39:15 -0600

Tetragramm gravatar image

I've recently installed the OpenCV in Visual Studio. My little program reads and open an image it doesn't work bc of this error at the 'imshow' line. I don't understand exactly what I have to do for this error. I'll put here my code (a simple code for reading an image). Thank you so much

#include<opencv2/opencv.hpp>
#include<opencv2/core/mat.hpp>
#include<iostream>

using namespace std;
using namespace cv;

int main()
{
Mat img = imread("lena.png");
    namedWindow("image", WINDOW_NORMAL);
    imshow("image", img); //the error appears here and the name of it is Excepsion Unhandled (the compile step has been done successfully and the built too, but at Local Window Debugger Step (Run Step) it appears in the middle of process)
    waitKey(0);
    return 0;
}

At the include lines I've mentioned this libraries: opencv2/opencv.hpp, opencv2/core/mat.hpp, iostream.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-03-13 16:54:52 -0600

mvuori gravatar image

You need to learn programming. You need to verify that the image you give to imshow is valid, that is, that your imread succeeded. If your data is not good, your code will crash with more libraries than just OpenCV.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-03-13 15:36:54 -0600

Seen: 3,815 times

Last updated: Mar 13 '20