OpenCV cannot load images
Hi, I'm using the code from "https://help.ubuntu.com/community/OpenCV" in the C++ section, and I'm having trouble with the following code:
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/ml/ml.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main()
{
Mat img = imread("/home/courtneym/Pictures/index.jpeg",CV_LOAD_IMAGE_COLOR);
imshow("opencvtest",img);
waitKey(0);
return 0;
}
I keep getting this error when I try to run it:
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/courtneym/opencv/modules/highgui/src/window.cpp, line 276 terminate called after throwing an instance of 'cv::Exception' what(): /home/courtneym/opencv/modules/highgui/src/window.cpp:276: error: (-215) size.width>0 && size.height>0 in function imshow
Aborted (core dumped)
Use the search bar of the forum to find several different threads with solutions to this problem. First of all, I'd check if the image is indeed index.jpeg and not index.jpg
that ubuntu page should be erased.