opencv中利用main函数的参数来进行人脸识别的问题
#include<iostream>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/objdetect/objdetect.hpp>
//#include<cv.h>
//#include<highgui.h>
#include<fstream>
using namespace std;
using namespace cv;
String classifier="data/haarcascade_frontalface_alt.xml";
int main(int argc,char* argv[])
{
CascadeClassifier face_detect;
face_detect.load(classifier);
//./datasetsDetected img_path.txt;
char* filename=argv[1];
ifstream fin(filename);
for(string image_path;getline(fin,image_path);)
{
vector<Rect> faces;
Mat input_image=imread(image_path);
face_detect.detectMultiScale(input_image,
faces,1.1,2,0,Size(30,30));
for(int i=0;i<faces.size();i++)
{
Rect rect=faces[i];
rectangle(input_image,rect,
Scalar(255,0,0),2);
}
imwrite("detected_face/"+image_path,input_image);
}
return 0;
}