#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/ml/ml.hpp>
#include "cv.h"
#include "highgui.h"
#include <cstdio>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
ifstream Test("negatives/infofile.txt");
string ImgName;//图片名(绝对路径)
for (int num = 0; getline(Test, ImgName); num++)
{
cout << "Processing:" << ImgName << endl;
Mat src = imread(ImgName);//读取图片
Mat src_gray;
//Mat src = imread("lena.jpg");
if (!src.data)
{
return -1;
}
cvtColor(src, src_gray, CV_RGB2GRAY);
stringstream ss;
string Img1;
ss << num;
ss >> Img1;
Img1 = Img1 + "ImgProcessed.bmp";
imwrite(Img1, src_gray);
}
}