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. 如何在linux环境下配置环境变量

    jdk下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 在linux环 ...

  2. 《BUG创造队》作业8:软件测试与Alpha冲刺(第二天)

    项目 内容 这个作业属于哪个课程 2016级软件工程 这个作业的要求在哪里 实验十二 团队作业8:软件测试与ALPHA冲刺 团队名称 BUG创造队 作业学习目标 (1)掌握软件测试基础技术.(2)学习 ...

  3. CH6302 雨天的尾巴

    6302 雨天的尾巴 0x60「图论」例题 背景 深绘里一直很讨厌雨天. 灼热的天气穿透了前半个夏天,后来一场大雨和随之而来的洪水,浇灭了一切. 虽然深绘里家乡的小村落对洪水有着顽固的抵抗力,但也倒了 ...

  4. 向指定URL发送GET和POST请求

    package com.sinosoft.ap.wj.common.util; import java.io.BufferedReader;import java.io.IOException;imp ...

  5. 什么是C/S和B/S架构?

    C/S架构 C/S即:Client与Server ,中文意思:客户端与服务器端架构,这种架构也是从用户层面(也可以是物理层面)来划分的. 这里的客户端一般泛指客户端应用程序EXE,程序需要先安装后,才 ...

  6. jumpserver 安装

    # CentOS 7 安装jumpserver $ setenforce 0 # 可以设置配置文件永久关闭$ systemctl stop iptables.service$ systemctl st ...

  7. mysqli类的对象和其属性方法;mysqli类面向过程的属性和方法

    mysqli 方法的概述 mysqli 类 面向对象接口 面向过程接口   描述 属性 $mysqli::affected_rows mysqli_affected_rows() 获取上次 Mysql ...

  8. OPCode详解及汇编与反汇编原理

    1. 何为OPCode 在计算机科学领域中,操作码(Operation Code, OPCode)被用于描述机器语言指令中,指定要执行某种操作的那部分机器码,构成OPCode的指令格式和规范由处理器的 ...

  9. leetcode解题报告(24):Pascal's TriangleII

    描述 Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [ ...

  10. Neither shaken nor stirred(DFS理解+vector存图)

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=2013 题目理解: 给定n个点的有向图: 下面n行,第一个数字表示点权,后面一个数字m表示 ...