欢迎来到天天文库
浏览记录
ID:6031133
大小:40.00 KB
页数:7页
时间:2017-12-31
《face识别 opencv程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include"opencv2/objdetect/objdetect.hpp"#include"opencv2/highgui/highgui.hpp"#include"opencv2/imgproc/imgproc.hpp"#include#include#include#includeusingnamespacestd;usingnamespacecv;staticvoidhelp(){cout<<"Thisprogramdemonstr
2、atesthecascaderecognizer.NowyoucanuseHaarorLBPfeatures.""Thisclassifiercanrecognizemanykindsofrigidobjects,oncetheappropriateclassifieristrained.""It'smostknownuseisforfaces.""Usage:""./facedetect[--cascade=thisistheprimarytrainedclassifiersu
3、chasfrontalface]""[--nested-cascade[=nested_cascade_paththisanoptionalsecondaryclassifiersuchaseyes]]""[--scale=]""[--try-flip]""[filename
4、camera_index]""seefacedetect.cmdforonecall:""./facedetect--cascad
5、e="../../data/haarcascades/haarcascade_frontalface_alt.xml"--nested-cascade="../../data/haarcascades/haarcascade_eye.xml"--scale=1.3""Duringexecution:tHitanykeytoquit.""tUsingOpenCVversion"<6、assifier&cascade,CascadeClassifier&nestedCascade,doublescale,booltryflip);stringcascadeName="../../data/haarcascades/haarcascade_frontalface_alt.xml";stringnestedCascadeName="../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml";intmain(intargc,constchar**a7、rgv){CvCapture*capture=0;Matframe,frameCopy,image;conststringscaleOpt="--scale=";size_tscaleOptLen=scaleOpt.length();conststringcascadeOpt="--cascade=";size_tcascadeOptLen=cascadeOpt.length();conststringnestedCascadeOpt="--nested-cascade";size_tnestedCascadeOptLen8、=nestedCascadeOpt.length();conststringtryFlipOpt="--try-flip";size_ttryFlipOptLen=tryFlipOpt.length();stringinputName;booltryflip=false;help();CascadeClassifiercascade,nestedCascade;doublescale=1;for(inti=1;i9、ascadeOpt.compare(0,cascadeOptLen,argv[i],cascadeOptLen)==0){cascadeName.assign(argv[i]+cascadeOptLen);cout<<"fromwhichwehavecascadeName="<
6、assifier&cascade,CascadeClassifier&nestedCascade,doublescale,booltryflip);stringcascadeName="../../data/haarcascades/haarcascade_frontalface_alt.xml";stringnestedCascadeName="../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml";intmain(intargc,constchar**a
7、rgv){CvCapture*capture=0;Matframe,frameCopy,image;conststringscaleOpt="--scale=";size_tscaleOptLen=scaleOpt.length();conststringcascadeOpt="--cascade=";size_tcascadeOptLen=cascadeOpt.length();conststringnestedCascadeOpt="--nested-cascade";size_tnestedCascadeOptLen
8、=nestedCascadeOpt.length();conststringtryFlipOpt="--try-flip";size_ttryFlipOptLen=tryFlipOpt.length();stringinputName;booltryflip=false;help();CascadeClassifiercascade,nestedCascade;doublescale=1;for(inti=1;i9、ascadeOpt.compare(0,cascadeOptLen,argv[i],cascadeOptLen)==0){cascadeName.assign(argv[i]+cascadeOptLen);cout<<"fromwhichwehavecascadeName="<
9、ascadeOpt.compare(0,cascadeOptLen,argv[i],cascadeOptLen)==0){cascadeName.assign(argv[i]+cascadeOptLen);cout<<"fromwhichwehavecascadeName="<
此文档下载收益归作者所有