Ask Your Question

Revision history [back]

How to debug imread()

I try to run the very first project. I have Visual Studio 2015, downloaded opencv-, and want to use ready libraries which are included. I prepared everything as described in Introduction to OpenCV \How to build applications with OpenCV inside the "Microsoft Visual Studio" Win32 console application (Debug mode) was created successfully. I have placed necessary DLL files in the same directory as EXE and placed BMP file in the same directory and into the project directory too. When I run the program, it fails with the code -1

Mat image;

// image = imread(argv[1], IMREAD_COLOR); // Read the file

image = imread("Circle.bmp"); // Read the file

if (! // Check for invalid input
    cout << "Could not open or find the image " << argv[1] << std::endl;
    return -1;

I tried to run with administrator rights, tried non-system directory, tried to run from Visual Studio IDE. How to determine why it can't read this file?