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

  • 大小: 3KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-03
  • 語言: C/C++
  • 標簽: 人臉識別??

資源簡介

ViolaJones是人臉識別中效率最高的,在OpenCV中對應的庫文件為cvHaarDetectObjects, 本文件為自己寫的識別代碼,調用該庫函數 配置好OpenCV之后可以使用

資源截圖

代碼片段和文件信息

//?opencvtest.cpp?:?entrnce?of?the?program

#include?“stdafx.h“
#include?

#include?

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

int?main(int?argc?char**?argv)
{
//?Declarations
IplImage?*?pInpImg?=0; //picture?that?waiting?for?detecting
CvHaarClassifierCascade?*?pCascade?=?0; //face?detector
CvMemStorage?*?pStorage?=?0; //?expandable?memory?buffer
CvSeq?*?pFaceRectSeq; //?list?of?detected?faces

//?initializations
pInpImg?=?cvLoadImage(“zhangxiaokang.jpg“); //loading?picture
pStorage?=?cvCreateMemStorage(0);
pCascade?=?(CvHaarClassifierCascade?*)cvLoad
???(“D:\\opencv\\data\\haarcascades\\haarcascade_frontalface_alt2.xml“ //classifier?provided?by?OpenCV
???0?0?0?);

//?validate?that?everything?initialized?properly
if(?!pInpImg?||?!pStorage?||?!pCascade?)
{
printf(“Initialization?failed:?%s\n“
(!pInpImg)???“can‘t?load?image?file“?:
(!pCascade)??“can‘t?load?haar-cascade?--?“
?????????“make?sure?path?is?correct“?:
“unable?to?allocate?memory?for?data?storage“?argv[1]);
exit(-1);
}

//to?have?some?pre-process?of?the?picture
IplImage*?gray=cvCreateImage(cvSize(pInpImg->widthpInpImg->height)81); //creat?an?image?as?big?as?the?loaded?one
IplImage*?small_img=cvCreateImage(cvSize(cvRound(pInpImg->width/1.3)cvRound(pInpImg->height/1.3))81); //creat

評論

共有 條評論