读取图片路径
#include<vector>
#include<string>
#include<iostream>
using namespace std;
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
string dir_path = "F:\\2345Do\\2\\";
Directory dir;
string extenttype = "*.jpg";
vector<string> fileNames = dir.GetListFiles(dir_path, extenttype, false);
for (int i = 0; i < fileNames.size(); i++)
{
//get image name
string fileName = fileNames[i];
string fileFullName = dir_path + fileName;
cout << "File name:" << fileName << endl;
cout << "Full path:" << fileFullName << endl;
/*cv::Mat img = cv::imread(fileFullName);
cv::imshow("img", img);
cv::waitKey();*/
}
system("pause");
return 0;
}
显示图片
将以上的注释符去掉