opencv3.0 批量读取图片并裁剪到指定大小

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/ml/ml.hpp"
#include
#include
#include "opencv2/opencv.hpp"  
using namespace std;
using namespace cv;
int main()
{
for (int j = 531; j < 558; j++)//初始文件名
{
char buf[100];
Mat frame,frame2;
sprintf(buf, "%d.jpg", j);
frame = imread(buf, 1);
char path[100];
sprintf(path, "%d.jpg", j);//处理后的输出文件路径
cv::resize(frame, frame2, cv::Size(100, 100), (0, 0), (0, 0), cv::INTER_LINEAR);
/*cvtColor(frame2, frame2, CV_RGB2GRAY);
cv::imshow(path, frame2);*/
cv::imwrite(path, frame2);
}
}

你可能感兴趣的:(图像)