opencv批量修改图片尺寸

 1 #include"opencv2/opencv.hpp"
 2 
 3 using namespace std;
 4 using namespace cv;
 5 #include<opencv2/opencv.hpp>
 6 #include<iostream>
 7 using namespace cv;
 8 using namespace std;
 9 int main()
10 {
11     int a = 100;
12     char path[90];
13     for (a = 100; a < 248;a++)
14     {
15         sprintf(path, "E:\SVM_Class\trainnigdata\%d.jpg", a);
16         
17         Mat inputImg = imread(path, 0);
18         
19         Mat resizea;
20         resizea.create(256, 224, CV_8UC1);
21         resize(inputImg, resizea, resizea.size(), 0, 0, INTER_CUBIC);
22         if (1)
23         {
24             stringstream ss;
25             ss << a << ".jpg";
26             imwrite(ss.str(), resizea);
27             
28         }
29     }
30     system("pause");
31 }
原文地址:https://www.cnblogs.com/hsy1941/p/7994299.html