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 ...
随机推荐
- 1219 Vue项目创建及基础
目录 vue项目 1. 项目创建 cmd创建 可视化创建 2. 项目启动 vue重新构建依赖 pycharm管理vue项目 3. 项目目录介绍 index.html index.js App.vue ...
- Linux 系统 Composer 安装
Composer 是个包管理工具 在项目中使用它会很方便 本文中用 PHP 安装 1.下载安装 执行命令 curl -sS https://getcomposer.org/installer | ph ...
- python - django (request 获取 访问者的 IP)
使用 Django 获取访问者的 IP if request.META.get('HTTP_X_FORWARDED_FOR'): ip = request.META.get("HTTP_X_ ...
- .net web api 返回的是xml
var result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(dto2) ...
- Kafka ISR and AR HW 、 LEO
相信大家已经对 kafka 的基本概念已经有一定的了解了,下面直接来分析一下 ISR 和 AR 的概念. 0|1ISR and AR 简单来说,分区中的所有副本统称为 AR (Assigned Rep ...
- Openwrt路由器上安装python
在路由器安装python之前,还是经过了一番折腾的.淘宝上买了个已经刷好系统的小米迷你路由器,但里面安装的不是预期的Pandorbox,而是LEDE. 这个固件已经带了大量自带的软件,128的内存实在 ...
- 印象笔记作为todo(GTD相关)的一个尝试
印象笔记作为todo(GTD相关)的一个尝试 上来说结果: 失败 原则上的原因: 印象笔记作为一个比较重的笔记, 重点也不在于这一点, 虽然是可以新建清单之类的. 还是比较小巧的好一些. 最后使用的软 ...
- RabbitMQ面试问答(子文章)(持续更新)
-----> 总文章 入口 文章目录 [-----> 总文章 入口](https://blog.csdn.net/qq_37214567/article/details/90174445) ...
- Hadoop 压缩
压缩的好处 文件压缩的好处:减少文件存储锁需要的磁盘空间,加速数据在网络和磁盘上的传输. 常见的压缩格式 压缩格式 工具 算法 文件扩展名 是否可以切分 DELATE 无 DEFLATE .d ...
- Redis 3.2.100 配置注意
新装服务器外网连接报错 /Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstandin ...