c++における一括読み出しとピクチャの格納
694 ワード
#include
#include
#include
using namespace cv;
using namespace std;
int main()
{
string fileName, grayFile;
string str1, str2;
Mat srcImage, grayImage;
for (int i = 0; i <= 10; i++)
{
stringstream ss1, ss2;
ss1 << i;
ss1 >> str1;
//cout << str1 << endl;
fileName = "" + str1 + ".jpg";
srcImage = imread(fileName);
grayFile = "out" + str1 + ".jpg";
cvtColor(srcImage, grayImage, CV_BGR2GRAY);
imwrite(grayFile, grayImage);
}
system("pause");
return 0;
}
stringstream ss 1,ss 2;この文はforループに置かなければなりません.