Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )
Article Directory
Summary: File Path File not found error caused
I. Description of the problem:
Document:
1.jpg and Try.cpp in HelloOpencv directory.
Try.cpp
#include<opencv2/opencv.hpp>
using namespace cv;
int main()
{
Mat srcImage=imread("1.jpg");
imshow("Origin",srcImage);
waitKey(0);
return 0;
}
1.jpg
Compilation failed
the reason:
It can not find 1.jpg. The current path prefix is the outermost directory, the directory that is under the Main, but also in 1.jpg into a layer that HelloOpenCV in.
Second, the solution
1. moved out of the picture 1.jpg
2. Use an absolute path
Right picture, copy absolute path (Copy Path)