Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unable to load an image - Open CV not working with Visual Studio2015

Hi guys,

I have just set up open cv3.1.0 with visual studio 2015 on windows 10. My simple code for loading the image is as under:

   #include "opencv2\opencv.hpp"
    using namespace cv;

    int main(int argv, char** argc)
    {
        Mat test = imread("lena_color.jpg", CV_LOAD_IMAGE_UNCHANGED);
        imshow("test", test);
        waitKey();
    }

When i build this code and run it, an empty image is momentarily displayed and I get this error in the terminal window

"OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\buildslave64\win64_amdocl\master_PackSlave-win64-vc14-shared\opencv\modules\highgui\src\window.cpp, line 281"

I have placed my image in the active directory so i have no clue why it is not being accessed.