人脸识别引擎SeetaFaceEngine中Alignment模块使用的测试代码
人脸识别引擎SeetaFaceEngine中Alignment模块用于检测人脸关键点,包括5个点,两个眼的中心、鼻尖、两个嘴角,以下是测试代码:
int test_alignment()
{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 };const std::string path_images{ "E:/GitCode/Face_Test/testdata/" };seeta::FaceDetection detector("E:/GitCode/Face_Test/src/SeetaFaceEngine/FaceDetection/model/seeta_fd_frontal_v1.0.bin");detector.SetMinFaceSize(20);detector.SetMaxFaceSize(200);detector.SetScoreThresh(2.f);detector.SetImagePyramidScaleFactor(0.8f);detector.SetWindowStep(4, 4);seeta::FaceAlignment point_detector("E:/GitCode/Face_Test/src/SeetaFaceEngine/FaceAlignment/model/seeta_fa_v1.1.bin");for (auto name : images) {fprintf(stderr, "start detect image: %s\n", name.c_str());cv::Mat src_ = cv::imread(path_images + name, 1);if (src_.empty()) {fprintf(stderr, "read image error: %s\n", name.c_str());continue;}cv::Mat src;cv::cvtColor(src_, src, CV_BGR2GRAY);seeta::ImageData img_data;img_data.data = src.data;img_data.width = src.cols;img_data.height = src.rows;img_data.num_channels = 1;std::vector<seeta::FaceInfo> faces = detector.Detect(img_data);for (auto face : faces) {// Detect 5 facial landmarks: two eye centers, nose tip and two mouth cornersseeta::FacialLandmark points[5];point_detector.PointDetectLandmarks(img_data, face, points);cv::rectangle(src_, cv::Rect(face.bbox.x, face.bbox.y,face.bbox.width, face.bbox.height), cv::Scalar(0, 255, 0), 2);for (auto point : points) {cv::circle(src_, cv::Point(point.x, point.y), 2, cv::Scalar(0, 0, 255), 2);}}std::string save_result = path_images + "_" + name;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 + "_" + 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);return 0;
}
从网上找了20张图像,用于测试此模块,测试结果如下:
GitHub:https://github.com/fengbingchun/Face_Test
人脸识别引擎SeetaFaceEngine中Alignment模块使用的测试代码相关推荐
- 人脸识别引擎SeetaFaceEngine中Identification模块使用的测试代码
人脸识别引擎SeetaFaceEngine中Identification模块用于比较两幅人脸图像的相似度,以下是测试代码: int test_recognize() {const std::strin ...
- 人脸识别引擎SeetaFaceEngine中Detection模块使用的测试代码
人脸识别引擎SeetaFaceEngine中Detection模块用于人脸检测,以下是测试代码: int test_detection() {std::vector<std::string> ...
- 人脸识别引擎SeetaFaceEngine简介及在windows7 vs2013下的编译
SeetaFaceEngine是开源的C++人脸识别引擎,无需第三方库,它是由中科院计算所山世光老师团队研发.它的License是BSD-2. SeetaFaceEngine库包括三个模块:人脸检测( ...
- python开源的人脸识别库_什么是 SeetaFace 开源人脸识别引擎
区分不同的人是很多智能系统的必备能力.为实现此目的,一种可能的技术手段是通过对人脸的光学成像来感知人.识别人,即所谓的人脸识别技术.经过几十年的研发积累,特别是近年来深度学习技术的涌现,人脸识别取得了 ...
- SeetaFace开源人脸识别引擎
开源网址 目前,SeetaFace开源人脸识别引擎已全部发布在Github上供国内外同行和工业界使用,项目网址为:https://github.com/seetaface/SeetaFaceEngin ...
- 【SeetaFace】中科院山世光老师开源的Seetaface人脸识别引擎测试
Seetaface发布了第二个版本--Seetaface2: https://github.com/seetaface/SeetaFaceEngine2 SeetaFace2 Engine conta ...
- SeetaFace开源人脸识别引擎介绍
深度学习大讲堂致力于推送人工智能,深度学习方面的最新技术,产品以及活动.请关注我们的知乎专栏! 区分不同的人是很多智能系统的必备能力.为实现此目的,一种可能的技术手段是通过对人脸的光学成像来感知人.识 ...
- C/C++人脸识别引擎 SeetaFace2打造“刷脸时代”
SeetaFace2 人脸识别引擎包括了搭建一套全自动人脸识别系统所需的三个核心模块,即:人脸检测模块 FaceDetector.面部关键点定位模块 FaceLandmarker 以及人脸特征提取与比 ...
- C# 实现人脸识别一 (运用虹软人脸识别引擎)
知识背景: 下载虹软人脸识别引擎 下载地址: http://www.arcsoft.com.cn/ai/arcface.html 目前虹软人脸识别引擎有3个平台,其中Windows与iOS是基于C++ ...
最新文章
- 德勒报告:2018年全球生命科学发展趋势
- linux find 反转 查找没有被找到的结果
- 用PyTorch实现的李沐《动手学深度学习》,登上GitHub热榜,获得700+星
- 牛客练习赛24题解(搜索,DP)
- 图像分割 2020 最新进展
- 美团大咖:程序员35岁前应做好的技术积累
- 【git】搭建git服务器
- 最简单判断系统大小端
- 【DBN预测】基于粒子群算法优化DBN深度置信网络实现数据预测matlab代码
- vue3实现商城左右联动数据---BScroll(vue3代码复制就能用)
- Android集成高德地图导航SDK、实现App内进行导航、打开高德App导航
- html 批量pdf 打印,前端连接打印机批量打印pdf格式的文件
- D.MADMAX 记忆化搜索 DAG
- 渗透测试技巧总结更新篇2
- handsome主题添加服务器信息,全屏响应式精美typecho主题handsome
- 深度学习经典优化算法-公式汇总
- linux用屏幕录制软件下载,vokoscreenNG(屏幕录制软件)下载_vokoscreenNG(屏幕录制软件)官方下载-太平洋下载中心...
- 秋枫学习笔记-原创文章整理
- 使用a标签时不用href=““调转页面
- 【linux】-find、rm、kill等常用命令