人脸检测 libfacedetection-cnn win10-vs2017实现

1 代码下载

于仕琪老师的公开代码地址

链接: link.
在这里插入图片描述

2 建立新的控制台程序

在这里插入图片描述

3 添加现有项

将下载的代码解压缩,在src中的四个(如图)复制到工程中libfacedetect文件夹下,并添加至工程。
在这里插入图片描述
在工程中新建 .cpp ,然后将example中的detect-image.cpp(修改如下)复制到新建cpp文件

#include <stdio.h>
#include <opencv2/opencv.hpp>
#include "facedetectcnn.h"

//define the buffer size. Do not change the size!
#define DETECT_BUFFER_SIZE 0x20000
using namespace cv;

int main()
{
   
	string str = "H:/人脸识别/DataSets/AR-full-bmp/man/002/22.bmp";
	Mat image = imread(str);
	if(!image.empty())
	{
   
		int * pResults = NULL; 
		//pBuffer is used in the detection functions.
		//If you call functions in multiple threads, please create one buffer for each thread!
		unsigned char * pBuffer = (unsigned char *)malloc(DETECT_BUFFER_SIZE);
		if(!pBuffer)
		{
   
			fprintf(stderr, "Can not alloc buffer.\n");
			//return -1;
		}	
		///
		// CNN face detection 
		// Best detection rate
		//
		//!!! The input image must be a BGR one (three-channel) instead of RGB
		//!!! DO NOT RELEASE pResults !!!
		TickMeter cvtm;
		cvtm.start();
		pResults = facedetect_cnn(pBuffer, (unsigned ch
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值