C++RGB转灰度图+高斯模糊

发布于:2021-09-26 10:57:44

#include
//#include
#include
#include
#include

using namespace cv;
using namespace std;


int main() {
ifstream file("/home/test-1573/file.txt");

int img_index = 0;

while (!file.eof()) {
char txt_cont[10000];
file.getline(txt_cont, 10000);

char img_file[10000], save_file[10000];

sprintf(img_file, "/home/test-1573/caffe/data/Chinese/aligned_train/%s", txt_cont);
sprintf(save_file, "/home/test-1573/caffe/data/huidu/%d.jpg", img_index);


Mat src = imread(img_file);
Mat dst;
//namedWindow("RGB",WINDOW_AUTOSIZE);
//imshow("RGB",src);
cvtColor(src, dst, CV_BGR2GRAY);
//namedWindow("GRAY", WINDOW_AUTOSIZE);
Mat out;
GaussianBlur(dst,out,Size(5,5),0,0);
imshow("GRAY+Fileter", out);
waitKey(0);

imwrite(save_file, out);
img_index++;
//waitKey(0);
}
return 0;
}




相关推荐

最新更新

猜你喜欢