64,683
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <fstream>
#include <math.h>
#include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <vector>
#include <map>
#include <time.h>
#include <Shlwapi.h>
#pragma comment(lib,"shlwapi.lib")//此语句用于建立文件夹路径
using namespace cv;
using namespace std;
int main()
{
//建立图像保存文件夹路径
string filepath_out = "..\\output\\purewhite\\";
if (!PathIsDirectory(filepath_out.c_str()))
{
CreateDirectory(filepath_out.c_str(), NULL);//创建目录,已经存在的话不影响
}
for (int i = 1; i < 38; i++)
{
string filepath_in = "..\\input\\purewhite\\" + to_string(i) + "\\";
Mat imgLeft = imread(filepath_in + "ImgLeft_9.bmp", 0);
Mat imgRight = imread(filepath_in + "ImgRight_9.bmp", 0);
filepath_out += to_string(i);
if (!PathIsDirectory(filepath_out.c_str()))
{
CreateDirectory(filepath_out.c_str(), NULL);
}
imwrite(filepath_out + "\\ImgLeft.bmp", imgLeft);
imwrite(filepath_out + "\\ImgRight.bmp", imgRight);
}
system("pause");
}