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

来源:互联网 发布:johnny cash知乎 编辑:程序博客网 时间:2024/06/07 12:33
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/ml/ml.hpp"
#include <opencv2/core/core.hpp>
#include<iostream>
#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);
}
}
原创粉丝点击