libfacedetection
libfacedetection测试
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <facedetect-dll.h> //define the buffer size. Do not change the size!
//定义缓冲区大小 不要改变大小!
#define DETECT_BUFFER_SIZE 0x20000
using namespace cv; unsigned char * pBuffer; void facedetect_frontal_surveillance1(Mat image); int main()
{
VideoCapture video1();
Mat image;
while ()
{
pBuffer = (unsigned char *)malloc(DETECT_BUFFER_SIZE);
if (!pBuffer)
{
fprintf(stderr, "Can not alloc buffer.\n");
return -;
} //load an image and convert it to gray (single-channel)
//加载图像并将其转换为灰色(单通道)
//Mat image = imread("E:\\libfacedetection\\libfacedetection_install\\images\\keliamoniz1.jpg");
video1.read(image);
//Mat image = imread("E:\\libfacedetection\\libfacedetection_install\\images\\1.jpg");
if (image.empty())
{
return -;
}
facedetect_frontal_surveillance1(image); //waitKey();
char c1 = waitKey();
if (c1 == )
{
break;
} free(pBuffer);
} //release the buffer return ;
} void facedetect_frontal_surveillance1(Mat image)
{
int w1 = image.cols;
int h1 = image.rows; Mat gray;
cvtColor(image, gray, CV_BGR2GRAY); int min_obj_width = ;
float scale1 = 1.1f;
int min_neightbors1 = ; int * pResults = NULL;
//pBuffer is used in the detection functions.
//pBuffer指针用于检测函数。
//If you call functions in multiple threads, please create one buffer for each thread!
//如果您在多个线程中调用函数,请为每个线程创建一个缓冲区! int doLandmark = ; ///////////////////////////////////////////
// frontal face detection designed for video surveillance / 68 landmark detection
//正面人脸检测专为视频监控/ 68标志性检测而设计
// it can detect faces with bad illumination.
//它可以检测到不良照明的面部。
//////////////////////////////////////////
//!!! The input image must be a gray one (single-channel)
//!!! DO NOT RELEASE pResults !!!
pResults = facedetect_frontal_surveillance(pBuffer, (unsigned char*)(gray.ptr()), gray.cols, gray.rows, (int)gray.step,
scale1, min_neightbors1, min_obj_width, , doLandmark);
//printf("%d faces detected.\n", (pResults ? *pResults : 0));
Mat result_frontal_surveillance = image.clone();;
//print the detection results
for (int i = ; i < (pResults ? *pResults : ); i++)
{
short * p = ((short*)(pResults + )) + * i;
int x = p[];
int y = p[];
int w = p[];
int h = p[];
int neighbors = p[];
int angle = p[]; printf("face_rect=[%d, %d, %d, %d], neighbors=%d, angle=%d\n", x, y, w, h, neighbors, angle);
rectangle(result_frontal_surveillance, Rect(x, y, w, h), Scalar(, , ), );
if (doLandmark)
{
for (int j = ; j < ; j++)
circle(result_frontal_surveillance, Point((int)p[ + * j], (int)p[ + * j + ]), , Scalar(, , ));
}
} if (w1>)
{
resize(result_frontal_surveillance, result_frontal_surveillance, Size(w1 / , h1 / ));
} imshow("Results_frontal_surveillance", result_frontal_surveillance); }
libfacedetection的更多相关文章
- libfacedetection简单使用记录
目录 1.源码下载 2.编译 2.1.linux 2.2.Windows MINGW64 2.3.VS2017 NMake编译 3.简单测试程序 3.1.测试截图 3.2.测试代码如下 1.源码下载 ...
- 人脸检测库libfacedetection介绍
libfacedetection是于仕琪老师放到GitHub上的二进制库,没有源码,它的License是MIT,可以商用.目前只提供了windows 32和64位的release动态库,主页为http ...
- 如何快糙好猛的使用libfacedetection库【最新版】
前言 最近已经很少看CSDN了.这一年多准备考研,基本上怕是不会再怎么上了.以前有一个http://blog.csdn.net/mr_curry/article/details/51804072 如何 ...
- libfacedetection 人臉識別
计算相似度,然后比对 QVector<cv::Point> vec_point1 = facedetect_frontal_surveillance4(face_img.clone()); ...
- libfacedetection环境配置
E:\Opencv\libfacedetection_install1\include E:\Opencv\libfacedetection_install1\lib libfacedetect-x6 ...
- 【机器学习Machine Learning】资料大全
昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...
- ios项目里扒出来的json文件
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0. ...
- Github上关于iOS的各种开源项目集合(强烈建议大家收藏,查看,总有一款你需要)
下拉刷新 EGOTableViewPullRefresh - 最早的下拉刷新控件. SVPullToRefresh - 下拉刷新控件. MJRefresh - 仅需一行代码就可以为UITableVie ...
- iOS及Mac开源项目和学习资料【超级全面】
UI 下拉刷新 EGOTableViewPullRefresh – 最早的下拉刷新控件. SVPullToRefresh – 下拉刷新控件. MJRefresh – 仅需一行代码就可以为UITable ...
随机推荐
- 微信小程序~性能
(1)优化建议 setData setData 是小程序开发中使用最频繁的接口,也是最容易引发性能问题的接口.在介绍常见的错误用法前,先简单介绍一下 setData 背后的工作原理. 工作原理 小程序 ...
- 项目(二)--完成练手feed流网站开发部署
样式需要优化,最简版,还需新增逻辑. 点击跳转 源码
- JDK源码那些事儿之LinkedTransferQueue
在JDK8的阻塞队列实现中还有两个未进行说明,今天继续对其中的一个阻塞队列LinkedTransferQueue进行源码分析,如果之前的队列分析已经让你对阻塞队列有了一定的了解,相信本文要讲解的Lin ...
- 2019-2020-1 20199301《Linux内核原理与分析》第七周作业
第六章 进程的描述和进程的创建 学习笔记 1.操作系统的三大管理功能: 进程管理 内存管理 文件系统 2.操作系统最核心的功能是进程管理. 3.为了管理进程,内核要描述进程的结构,也成为进程描述符,进 ...
- 「NOI2007」 货币兑换
「NOI2007」 货币兑换 题目描述 小 Y 最近在一家金券交易所工作.该金券交易所只发行交易两种金券:A 纪念券(以下简称 A 券)和 B 纪念券(以下简称 B 券).每个持有金券的顾客都有一个自 ...
- KVM虚拟机,如何设置虚拟机的CPU型号与物理机是一样的
1.在kvm主机上修改配置文件 [root@node160 ~]# virsh edit CentOS-7.3-X86_64 将xml配置文件中的: <cpu mode='custom' mat ...
- asp.net MVC 使用wifidog 协议实现wifi认证
在网上看到的很多实现的wifidog 协议一般都是PHP 的,了解一下PHP 但是比较喜欢.net ,所以实现了简单的一个进行登录认证的功能 (好多协议中的功能目前没有实现) 1. 开发环境(vs20 ...
- web表单
1.配置 使用Flask-WTF, 它集成了WTForms并且完美地集成到了flask. 在microblog根目录下创建一个文件,存储flask扩展的所有配置,CSRF_ENABLED用于激活跨站点 ...
- Js验证正则表达式
//验证是否手机 var base = Objcet();base.isPhone = function(num) { var preg = /^1[3-7,8]{1}[0-9]{9}$/; retu ...
- AtCoder Grand Contest 011题解
传送门 \(A\) 直接按时间排序之后贪心就可以了 const int N=1e5+5; int a[N],q[N],c,k,h,t,n,res; inline int min(R int x,R i ...