I am trying to write a basic program in opencv that just displays an image, but imread does not seem to be working.I have libopencv_core.so and libopencv_highgui.so linked to the program and I'm using linux.
Here is my code:
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat img = imread("test.jpg", 1);
if(!img.data)//This if statement is triggered
{
cout<<"Error!\n"
return -1;
}
namedWindow("Test", CV_WINDOW_AUTOSIZE);
imshow("Test", img);
waitKey(0);
return 1;
}
Thank you