Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please burn that, immediately. whereever you found that, don't go back there again.

this is opencv1.0 c-based code from before 2010, you MUST NOT use it.

#include "opencv2/opencv.hpp"
using namespace cv;
int main() {
    Mat img = imread("/some/path/img.png");
    if (img.empty()) {  // most likely, here's your problem.
          // not found, wrong path, adjust, and try again !
          return -1;
    }
    imshow("Example", img);
    waitKey();
    return 0;
}

please burn that, immediately. whereever you found that, don't go back there again.

this is opencv1.0 c-based code from before 2010, you MUST NOT use it.

#include "opencv2/opencv.hpp"
using namespace cv;
int main() {
    Mat img = imread("/some/path/img.png");
    if (img.empty()) {  // most likely, here's your problem.
          // not found, wrong path, adjust, and try again !
          return -1;
    }
    imshow("Example", img);
    waitKey();
    return 0;
}

please also take a tour of the tutorials here