Where do I save an Image for calling it with cv::imread
Hi! I'm using opencv for reading an image that later I'm going to use as a reference in my ROS node, the problem is that my code isn't reading it. I saved it in the src folder inside the package folder, that is, in the same folder as the .cpp Here is the code that does it:
cv_ptr=cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
cv::Mat img2;
//Thresholding
cv::cvtColor(cv_ptr->image,img2,CV_BGR2GRAY);
Mat img1 = imread("bucher.jpg", CV_LOAD_IMAGE_GRAYSCALE );
if( img1.empty() ) {
printf("Error occured, image not read correctly");
}
The terminal is always showing me that error, then it isnt reading correctly the image. I don't know if maybe I have to modify something in the CMakeLists.txt to be able to use the image.
I apreciate your help, thanks