环境:VS2017+win7+openCV3.4
#include <iostream>
#include <sstream>//格式转换,这里是int转为string
#include <string>
#include <io.h> //进行系统文件操作的头文件
using namespace std;
const int N = 3;//假如少于100张,N=2,则编号1~99;N=3,则编号01~099,N=4,则编号0001~0099
const string fileType = ".pgm";//需要重命名图片的格式
string int2string(int n, int i);//类型转换函数
int main()
{
_finddata_t file; // 查找文件的类
string fileDirectory = "E:\\faceRec\\facePictures\\face_dec\\positivePic"; //文件夹目录,自己修改
string buffer = fileDirectory + "\\*" + fileType;
//long hFile;//win7系统
intptr_t hFile;//win10系统
hFile = _findfirst(buffer.c_str(), &file); //找第一个文件
if (hFile == -1L)
cout << "没有指定格式的图片" << endl;//没有指定格式的图片
else
{
int i = 0;
string newFullFilePath;
string oldFullFilePath;
string strName;
do
{
oldFullFile