I’m using VS2019.
I put “starry_night.jpg” in the Sources Files folder
Code from OpenCV: Getting Started with Images
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
using namespace cv;
int main()
{
std::string image_path = samples::findFile("starry_night.jpg");
Mat img = imread(image_path, IMREAD_COLOR);
if (img.empty())
{
std::cout << "Could not read the image: " << image_path << std::endl;
return 1;
}
imshow("Display window", img);
int k = waitKey(0); // Wait for a keystroke in the window
if (k == 's')
{
imwrite("starry_night.png", img);
}
return 0;
}
In this command prompt gives this error:
[ WARN:0] global C:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\samples.cpp (61) cv::samples::findFile cv::samples::findFile('starry_night.jpg') => ''
OpenCV(4.5.3) Error: Unspecified error (OpenCV samples: Can't find required data file: starry_night.jpg) in cv::samples::findFile, file C:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\samples.cpp, line 64
I’m stumped. How do I decipher this error?