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的更多相关文章

  1. libfacedetection简单使用记录

    目录 1.源码下载 2.编译 2.1.linux 2.2.Windows MINGW64 2.3.VS2017 NMake编译 3.简单测试程序 3.1.测试截图 3.2.测试代码如下 1.源码下载 ...

  2. 人脸检测库libfacedetection介绍

    libfacedetection是于仕琪老师放到GitHub上的二进制库,没有源码,它的License是MIT,可以商用.目前只提供了windows 32和64位的release动态库,主页为http ...

  3. 如何快糙好猛的使用libfacedetection库【最新版】

    前言 最近已经很少看CSDN了.这一年多准备考研,基本上怕是不会再怎么上了.以前有一个http://blog.csdn.net/mr_curry/article/details/51804072 如何 ...

  4. libfacedetection 人臉識別

    计算相似度,然后比对 QVector<cv::Point> vec_point1 = facedetect_frontal_surveillance4(face_img.clone()); ...

  5. libfacedetection环境配置

    E:\Opencv\libfacedetection_install1\include E:\Opencv\libfacedetection_install1\lib libfacedetect-x6 ...

  6. 【机器学习Machine Learning】资料大全

    昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...

  7. 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. ...

  8. Github上关于iOS的各种开源项目集合(强烈建议大家收藏,查看,总有一款你需要)

    下拉刷新 EGOTableViewPullRefresh - 最早的下拉刷新控件. SVPullToRefresh - 下拉刷新控件. MJRefresh - 仅需一行代码就可以为UITableVie ...

  9. iOS及Mac开源项目和学习资料【超级全面】

    UI 下拉刷新 EGOTableViewPullRefresh – 最早的下拉刷新控件. SVPullToRefresh – 下拉刷新控件. MJRefresh – 仅需一行代码就可以为UITable ...

随机推荐

  1. machine learning (6)---how to choose features, polynomial regression

    how to choose features, polynomial regression:通过定义更适合我们的feature,选择更好的模型,使我们的曲线与数据更好的拟合(而不仅仅是一条直线) 可以 ...

  2. service worker(二)之主页面与service worker通信

    实现一个主页面发送消息,worker搜到信息向所有的页面派发消息(当前页面除外) msg.html <!DOCTYPE html> <html lang="en" ...

  3. http之browser抓包

    Chrome 抓包 详解谷歌Network 面板 快捷键:Control+Shift+I (Windows) or Command+Option+I (Mac) 控制器 补充知识: HAR Chrom ...

  4. matlab之数组反序输出

    a=[1 2 3 4 5] a(end:-1:1)=[5 4 3 2 1]

  5. jquery锚点跳转

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  6. 洛谷 P1279 字串距离 题解

    每日一题 day24 打卡 Analysis 字符串+dp 仔细观察发现,对于f[i][j],它的值为以下三个值中的最小者: f[i-1][j]+k //a[i]对应空格 f[i][j-1]+k // ...

  7. YAML_10 把监听端口是8080的Apache服务全部停止

    ansible]# vim ad.yml --- - hosts: cache   remote_user: root   tasks:     - shell: netstat -atunlp  | ...

  8. luogu P1058 立体图

    做了这个题后明确了自己的定位... 恩...普及- 题目大意估计都知道.. 给个传送门:   luogu 做了半上午 + 一整个下午的题... 占了我今天到的绝大多数时间. 其实此题不难, 核心代码我 ...

  9. shell 一次性杀掉相同名称的进程

    这条命令将会杀掉所有含有关键字"LOCAL=NO"的进程 ps -ef|grep LOCAL=NO|grep -v grep|cut -c -|xargs kill - 另一种方法 ...

  10. Prometheus Consul实现自动服务发现

    Prometheus Consul实现自动服务发现   1.概述 Consul 是一个支持多数据中心分布式高可用的服务发现和配置共享的服务软件. Consul 由 HashiCorp公司用Go语言开发 ...