91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

Opencv 下Cascade Classifier實現人臉識別的例程

資源截圖

代碼片段和文件信息

//?objectDetection2.cpp?:?定義控制臺應用程序的入口點。
//

#include?“stdafx.h“

//#define?CAM?1


/**
?*?@file?objectDetection2.cpp
?*?@author?A.?Huaman?(?based?in?the?classic?facedetect.cpp?in?samples/c?)
?*?@brief?A?simplified?version?of?facedetect.cpp?show?how?to?load?a?cascade?classifier?and?how?to?find?objects?(Face?+?eyes)?in?a?video?stream?-?Using?LBP?here
?*/
#include?“opencv2/objdetect/objdetect.hpp“
#include?“opencv2/highgui/highgui.hpp“
#include?“opencv2/imgproc/imgproc.hpp“

#include?
#include?

using?namespace?std;
using?namespace?cv;


/**?Function?Headers?*/
void?detectAndDisplay(?Mat?frame?);

/**?Global?variables?*/
String?face_cascade_name?=?“lbpcascade_frontalface.xml“;//;haarcascade_frontalface_alt.xml
String?eyes_cascade_name?=?“haarcascade_eye.xml“;//haarcascade_eye_tree_eyeglasses.xml
String?nose_cascade_name?=?“haarcascade_mcs_mouth.xml“;//haarcascade_mcs_mouth.xml
CascadeClassifier?face_cascade;
CascadeClassifier?eyes_cascade;
CascadeClassifier?nose_cascade;
string?window_name?=?“Capture?-?Face?detection“;

//RNG?rng(12345);

/**
?*?@function?main
?*/
int?main(?void?)
{
??VideoCapture?capture;
??Mat?frame;

??//--?1.?Load?the?cascade
??if(?!face_cascade.load(?face_cascade_name?)?){?printf(“--(!)Error?loading\n“);?return?-1;?}
??if(?!eyes_cascade.load(?eyes_cascade_name?)?){?printf(“--(!)Error?loading\n“);?return?-1;?}
??if(?!nose_cascade.load(?nose_cascade_name?)?){?printf(“--(!)Error?loading\n“);?return?-1;?}

#if?defined?CAM?
??//--?2.?Read?the?video?stream
??capture.open(?0?);
??if(?capture.isOpened()?)
??{
for(;;)
{
??capture?>>?frame;
??
??//--?3.?Apply?the?classifier?to?the?frame
??if(?!frame.empty()?)
???{?
???detectAndDisplay(?frame?);
??
???}
??else
???{?
???printf(“?--(!)?No?captured?frame?--?Break!“);
???????break;
???}

??int?c?=?waitKey(10);
??if(?(char)c?==?‘c‘?)?
??{
???capture.release();
???break;
??}

?}
??}
#else
??????//frame?=?imread(?“angela2.jpg“?1?);
???????frame?=?imread(?“7299155_142410631000_2.jpg“?1?);
???if(!frame.data)
???{?printf(“--(!)Error?frame\n“);?return?-1;?}
??namedWindow(?window_name?CV_WINDOW_AUTOSIZE);//WINDOW_NORMAL
??detectAndDisplay(?frame?);
??waitKey(0);
#endif?
??return?0;
}

/**
?*?@function?detectAndDisplay
?*/
void?detectAndDisplay(?Mat?frame?)
{
???std::vector?facesnose;
???Mat?frame_gray;
const?static?Scalar?colors[]?=??{?
CV_RGB(00255)
CV_RGB(0128255)
CV_RGB(0255255)
CV_RGB(02550)
CV_RGB(2551280)
CV_RGB(2552550)
CV_RGB(25500)
CV_RGB(2550255)
CV_RGB(1280255)
CV_RGB(2550128)
}?;

???cvtColor(?frame?frame_gray?COLOR_BGR2GRAY?);
???resize(?frame_gray?frame_gray?frame_gray.size()?0?0?INTER_LINEAR?);
???equalizeHist(?frame_gray?frame_gray?);
???
???//--?Detect?faces
???face_cascade.detectMultiScale(?frame_gray?faces?1.01?6

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-02-10?11:50??objectDetection2\
?????目錄???????????0??2015-02-10?10:40??objectDetection2\Debug\
?????文件???????70144??2015-02-10?11:05??objectDetection2\Debug\objectDetection2.exe
?????文件?????1007348??2015-02-10?11:05??objectDetection2\Debug\objectDetection2.ilk
?????文件?????1264640??2015-02-10?11:05??objectDetection2\Debug\objectDetection2.pdb
?????目錄???????????0??2015-02-10?10:30??objectDetection2\objectDetection2\
?????文件??????129059??2015-02-10?00:52??objectDetection2\objectDetection2\1.jpg
?????文件???????68719??2015-02-09?23:34??objectDetection2\objectDetection2\4.jpg
?????文件??????206405??2015-02-10?09:59??objectDetection2\objectDetection2\7299155_142410631000_2.jpg
?????目錄???????????0??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\
?????文件???????15926??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\CL.read.1.tlog
?????文件????????1744??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\CL.write.1.tlog
?????文件????????1642??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\cl.command.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link-cvtres.read.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link-cvtres.write.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.3912-cvtres.read.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.3912-cvtres.write.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.3912.read.1.tlog
?????文件???????????2??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.3912.write.1.tlog
?????文件????????3112??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.command.1.tlog
?????文件????????5570??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.read.1.tlog
?????文件????????1430??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\link.write.1.tlog
?????文件?????????510??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\mt.command.1.tlog
?????文件?????????566??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\mt.read.1.tlog
?????文件?????????498??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\mt.write.1.tlog
?????文件????????3235??2015-02-10?10:40??objectDetection2\objectDetection2\Debug\objectDetection2.Build.CppClean.log
?????文件?????????406??2015-02-10?10:40??objectDetection2\objectDetection2\Debug\objectDetection2.exe.embed.manifest
?????文件?????????472??2015-02-10?10:40??objectDetection2\objectDetection2\Debug\objectDetection2.exe.embed.manifest.res
?????文件?????????381??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\objectDetection2.exe.intermediate.manifest
?????文件??????????95??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\objectDetection2.lastbuildstate
?????文件????????3385??2015-02-10?11:05??objectDetection2\objectDetection2\Debug\objectDetection2.log
............此處省略28個文件信息

評論

共有 條評論