opencv中利用main函数的参数来进行人脸识别的问题

csdnFLOL 2017-08-20 03:54:41
#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;
}
...全文
214 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
沐阳2100 2017-08-21
  • 打赏
  • 举报
回复
把错误提示贴出来有利于解决问题!另外可以先编译官方提供的例程。
csdnFLOL 2017-08-20
  • 打赏
  • 举报
回复
编译的时候出现致命错误,语法逻辑好像都没问题,但编译就错误百出,还请各位大神指教~

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧