#include <opencv2/core/utility.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include "math.h"
#include <iostream>
#include <string>
#include<sstream>
#include<experimental/filesystem>
#include <windows.h>
#include <io.h>
using namespace std;
using namespace cv;
namespace fs = std::experimental::filesystem;
void getJustCurrentFile(string path, vector<string>& files) {
//文件句柄
intptr_t hFile = 0;
//文件信息
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) {
do {
if ((fileinfo.attrib & _A_SUBDIR)) {
}
else {
files.push_back(fileinfo.name);
//files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
int main()
{
vector<string> files;
string pathname = "..\\hkImage\\";
string filename1 = "..\\resizeimage\\";
getJustCurrentFile(pathname, files);
int size = files.size();
Mat img;
for (int i = 0; i < size; i++) {
string path = pathname + files[i];
img = imread(path);
Mat dst;
resize(img, dst,Size(1280,720));
ostringstream os;
os << filename1 << files[i] ;
imwrite(os.str(), dst);
waitKey(1);
}
cout << "ok" << endl;
system("pause");
return 0;
}