OpenCV 2.0 C++ API using imshow: returns unhandled exception and “bad-flag”

后端 未结 6 1030
生来不讨喜
生来不讨喜 2020-12-07 02:08

I\'m trying to use the new OpenCV 2.0 API in MS Visual C++ 2008 and wrote this simple program:

cv::Mat img1 = cv::imread(\"image.jpg\",1);
cv::namedWindow(\"         


        
6条回答
  •  失恋的感觉
    2020-12-07 02:59

    As I just commented, imread isn't working for me either. A little googling shows other people having the same problem; I guess it's a bug in the library code. For now, here's a hacky workaround:

    IplImage* img = cvLoadImage("lena.jpg");
    cv::Mat lena(img);
    cvReleaseImage(&img);
    

    This way, you can at least use the C++ API for the rest of your stuff.

提交回复
热议问题