# include "stdafx. H"
# include & lt; String>
# include & lt; Opencv2 \ opencv. Hpp>
Using the namespace CV;
using namespace std;
Int main ()
{
String imagename="Lena. JPG";//here need to fill out an absolute address, when I test using relative error address,
//read in the image
Mat img=imread (imagename);
//read image failure
If (img. Empty ())
{
return -1;
}
//create a window
NamedWindow (" image ", 1);
//display images
Imshow (" image ", img);
//wait for buttons, press any key to return to the
keyboardWaitKey ();
return 0;
//error pointed out: feihongmeilian
//verified by himself, string imagename="Lena. JPG"; Is you can use the relative address, I use the environment as the OpenCV 2.4.3
//picture for meinv. The JPG in the code file folder folder at the next higher level, where the string imagename=".. \ \ meinv. JPG "image can be displayed normal,
//to be noted is the double quotes "" in the first slash \ as an escape character
}
Error fatal error C1083: cannot open include file: "opencv2 \ opencv. HPP" : No to the file or directory
How to solve? Early online for a long time did not find a solution,,,,,,, hope, can under the guidance of the great god
CodePudding user response:
The opencv. HPP in vs try install directory include folder