用visual studio 2012、opencv248实现人脸检测
一、保证你的visual studio 2012 和 opencv248配置成功,且可以显示图像。
若不能,可以参考这个网站。
二、新建一个项目,步骤如下:
1.文件>新建>项目:
2.把里面的代码删掉。
三、把如下代码粘贴进去。
// facedetectionMine.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include "cv.h"
#include "highgui.h"
using namespace std;
using namespace cv;
static CvHaarClassifierCascade* cascade = 0;
static CvMemStorage* storage = 0;
void detect_and_draw( IplImage* image ); //函数声明
const char* cascade_name ="haarcascade_frontalface_alt.xml";