//从文件中读入图像
1 AfxMessageBox(strPathName); //D:\demo\1.jpg
2 strPathName.Replace(_T("\\"),_T("\\\\"));
3 AfxMessageBox(strPathName); //D:\\demo\\1.jpg
4 Mat img = imread("strPathName"); //运行报错
如果Mat img = imread("D:\\demo\\1.jpg"); //运行正确
imshow("image before", img);
变量不要用引号
Mat img = imread(strPathName);