libfacedetection是于仕琪老师放到GitHub上的二进制库,没有源码,它的License是MIT,可以商用。目前只提供了windows 32和64位的release动态库,主页为https://github.com/ShiqiYu/libfacedetection,采用的算法好像是Multi-BlockLBP,提供了四套接口,分别为frontal、frontal_surveillance、multiview、multiview_reinforce,其中multiview_reinforce效果最好,速度比其它稍慢,四套接口的参数类型完全一致,可以根据需要对参数min_neighbors和min_object_width进行调整。

新建一个控制台工程,用来测试libfacedetection,测试代码如下:

#include <iostream>
#include <string>
#include <vector>
#include <facedetect-dll.h>
#include <opencv2/opencv.hpp>int main()
{std::vector<std::string> images{ "1.jpg", "2.jpg", "3.jpg", "4.jpeg", "5.jpeg", "6.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg","11.jpeg", "12.jpg", "13.jpeg", "14.jpg", "15.jpeg", "16.jpg", "17.jpg", "18.jpg", "19.jpg", "20.jpg" };std::vector<int> count_faces{1, 2, 6, 0, 1, 1, 1, 2, 1, 1,1, 1, 1, 1, 1, 1, 1, 0, 8, 2};std::string path_images{ "E:/GitCode/Face_Test/testdata/" };if (images.size() != count_faces.size()) {fprintf(stderr, "their size that images and count_faces are mismatch\n");return -1;}typedef int* (*detect_face)(unsigned char * gray_image_data, int width, int height, int step,float scale, int min_neighbors, int min_object_width, int max_object_width);detect_face detect_methods[]{&facedetect_frontal,&facedetect_multiview,&facedetect_multiview_reinforce,&facedetect_frontal_surveillance};std::string detect_type[4] {"face frontal", "face multiview", "face multiview reinforce", "face surveillance"};for (int method = 0; method < 4; method++) {detect_face detect = detect_methods[method];fprintf(stderr, "detect type: %s\n", detect_type[method].c_str());for (int i = 0; i < images.size(); i++) {cv::Mat src_ = cv::imread(path_images + images[i], 1);if (src_.empty()) {fprintf(stderr, "read image error: %s\n", images[i].c_str());return -1;}cv::Mat src;cv::cvtColor(src_, src, CV_BGR2GRAY);int* results = nullptr;results = detect(src.data, src.cols, src.rows, src.step, 1.2f, 2, 10, 0);std::string save_result = path_images + std::to_string(method) + "_" + images[i];//fprintf(stderr, "save result: %s\n", save_result.c_str());for (int faces = 0; faces < (results ? *results : 0); faces++) {short* p = ((short*)(results + 1)) + 6 * faces;int x = p[0];int y = p[1];int w = p[2];int h = p[3];int neighbors = p[4];int angle = p[5];fprintf(stderr, "image_name: %s, faces_num: %d, face_rect=[%d, %d, %d, %d], neighbors=%d, angle=%d\n",images[i].c_str(), *results, x, y, w, h, neighbors, angle);cv::rectangle(src_, cv::Rect(x, y, w, h), cv::Scalar(0, 255, 0), 2);}cv::imwrite(save_result, src_);}}int width = 200;int height = 200;cv::Mat dst(height * 5, width * 4, CV_8UC3);for (int i = 0; i < images.size(); i++) {std::string input_image = path_images + "2_" + images[i];cv::Mat src = cv::imread(input_image, 1);if (src.empty()) {fprintf(stderr, "read image error: %s\n", images[i].c_str());return -1;}cv::resize(src, src, cv::Size(width, height), 0, 0, 4);int x = (i * width) % (width * 4);int y = (i / 4) * height;cv::Mat part = dst(cv::Rect(x, y, width, height));src.copyTo(part);}std::string output_image = path_images + "result.png";cv::imwrite(output_image, dst);fprintf(stderr, "ok\n");return 0;
}

从网上找了20张图像,验证此库的检测率,下图是采用multiview_reinforce接口的检测结果:

GitHub:https://github.com/fengbingchun/Face_Test

人脸检测库libfacedetection介绍相关推荐

  1. 人脸检测库libfacedetection使用方法

    libfacedetection介绍 libfacedetection是一个开源的人脸检测库,使用C编写,将模型文件转化为C的静态变量,不依赖外部第三方库,使用时可以直接把源代码拷到自己的工程,也可以 ...

  2. 加量不加价!极速人脸检测库libfacedetection升级v3版,新增五点检测

    点击我爱计算机视觉标星,更快获取CVML新技术 在众多人脸检测开源库中,南方科技大学于仕琪老师组开源的libfacedetection向来以CPU下极速而著称,又因为其使用BSD协议故可商用,一直在开 ...

  3. 深大教授开源的人脸检测库,速度号称史上最快

    来自:开源最前线(ID:OpenSourceTop) 综合自:https://github.com/ShiqiYu/libfacedetection 上周,深圳大学计算机科学与软件工程学院的于仕琪教授 ...

  4. 如何快糙好猛的使用Shiqi.Yu老师的公开人脸检测库(附源码)

    前言 本次编写所用的库为于仕祺老师免费提供的人脸检测库.真心好用,识别率和识别速度完全不是Opencv自带的程序能够比拟的.将其配合Opencv的EigenFace算法,基本上可以形成一个小型的毕业设 ...

  5. 基于Android平台的简易人脸检测库

    代码地址如下: http://www.demodashi.com/demo/12135.html ViseFace 简易人脸检测库,不依赖三方库,可快速接入人脸检测功能. 项目依赖:compile ' ...

  6. 一个快速的人脸检测库

    这是我见过和使用过的最快的人脸检测库,而且还能检测到人脸转动的角度. 在此声明!本博客旨在学习研究交流之用,如果要用于商业目的,请直接联系于诗琪老师,获得授权!如有法律问题,本人概不负责! 于诗琪老师 ...

  7. libfacedetection 人脸检测库的基本使用

    目录 1.源码下载 2.编译 3.构建工程 4.个人总结 运行总结: 与CascadeClassifier级联分类器 人脸检测 对比: 1.源码下载 直接从github上克隆项目仓库. git clo ...

  8. java 人脸检测_Java人脸检测库

    您可以使用JavaCV进行面部检测.JavaCV是OpenCV的Java包装器.它没有提供真/假但是图片中面部的位置.你可以这样做: public class FaceDetect { // Crea ...

  9. 怎么把人脸检测的速度做到极致

    首先,我承认这个题目有点标题党.之所以写这篇,因为发现微信微博上有很多公司介绍他们的技术,但都是说如何如何牛,但缺少技术细节,对读者帮助有限.因此写一点相对干货多的东西,希望能帮助大家.如有谬误,也请 ...

最新文章

  1. python自带 python2转python3 代码工具
  2. jQuery的end()方法使用详解
  3. 089_学习过的html标签
  4. 从Gmail故障看SaaS的服务风险
  5. 机器人技术大提升:NVIDIA为构建自主机器统一平台树立里程碑
  6. linux学习之路(1)
  7. python简单选择排序_Python实现冒泡,插入,选择排序简单实例
  8. Java中调用本地代码
  9. shell中引号的应用
  10. 人工智能系列:AI 可视化训练平台
  11. php 芝麻认证think_谈谈php对接芝麻信用踩的坑
  12. 线性回归中一次性实现所有自变量的单因素分析
  13. Java8 新特性之stream
  14. matlab数学建模方法与实践 笔记1:快速入门
  15. Oracle/PLSQL登录oracle时出现 ORA-12638 Credential retrieval failed错误
  16. bzoj3786星系探索(splay维护dfs序)
  17. 服务器共享文件夹后防火墙设置,如何配置samba 要求共享文件夹public
  18. vmware虚拟机usb协调服务器,win10虚拟机vmware usb arbitration service找不到如何解决
  19. excel格式设置:自定义单元格让数据大变身
  20. 使用过程中蓝牙驱动突然消失

热门文章

  1. Gradient Descent梯度下降(透彻分析)
  2. 1.Socket通信
  3. tcmalloc mysql 缓存_Tcmalloc优化Mysql内存管理
  4. 剑指offer:面试题13. 机器人的运动范围
  5. vue element 导出blob后台文件流xlsx文件自动下载(且规避乱码)
  6. ATS中的命令行工具解读
  7. 3ds Max中的V-Ray学习
  8. C++ 泛型编程 -- 函数模版
  9. leetcode-25 K个一组反转链表
  10. 一小时Thinkphp后台(2)