当前位置: 首页 > news >正文

人脸特征68点识别 C++

1、加载一张图片
main函数:

	cv::Mat img = cv::imread("5.jpg");vector<Point2f> points_vec = dectectFace68(img);

请添加图片描述

2、人脸68特征识别函数

在这里vector<Point2f> dectectFace68(Mat src)
{vector<Point2f> points_vec;int* pResults = NULL;//在检测函数中使用了pBuffer。  //如果你调用多个线程中的函数,请为每个线程创建一个缓冲区!  unsigned char* pBuffer = (unsigned char*)malloc(DETECT_BUFFER_SIZE);if (!pBuffer){fprintf(stderr, "Can not alloc buffer.\n");//return 100;}Mat gray;cvtColor(src, gray, CV_BGR2GRAY);int doLandmark = 1;// do landmark detection  pResults = facedetect_multiview_reinforce(pBuffer, (unsigned char*)(gray.ptr(0)), gray.cols, gray.rows, (int)gray.step,1.2f, 2, 48, 0, doLandmark);int cxa = *pResults;ofstream file("facedata.txt", ios::out);//打印检测结果 if (0 == cxa){}else{for (int i = 0; i < (pResults ? *pResults : 0); i++){short* p = ((short*)(pResults + 1)) + 142 * i;//rectangle(src, Rect(p[0], p[1], p[2], p[3]), Scalar(0, 255, 0), 2);if (doLandmark){for (int j = 0; j < 68; j++){char c[8];_itoa(j, c, 10);Point2f ff(p[6 + 2 * j], p[6 + 2 * j + 1]);points_vec.push_back(ff);file << ff.x << "\t" << ff.y << endl;/*	circle(src, Point((int)p[6 + 2 * j], (int)p[6 + 2 * j + 1]), 3, Scalar(0, 0, 255), 3);CvPoint font;putText(src, c, Point((int)p[6 + 2 * j], (int)p[6 + 2 * j + 1]), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 23, 0), 1);*/}}}}return points_vec;
}插入代码片

3、结果
请添加图片描述

http://www.lryc.cn/news/391254.html

相关文章:

  • 部署LVS-DR 群集
  • nginx的正向代理和反向代理
  • 米国政府呼吁抛弃 C 和 C++
  • failed to lazily initialize a collection of role,解决Hibernate查询报错
  • Promethuse-监控 Etcd
  • linux桌面运维---第四天
  • 视频网关的作用
  • css+js实现导航栏色块跟随滑动+点击后增加样式
  • AudioLM音频生成模型:技术革新与应用前景
  • 数据结构教材关于C/C++的研究
  • 【刷题笔记(编程题)05】另类加法、走方格的方案数、井字棋、密码强度等级
  • 如何检查购买的Facebook账号优劣?
  • 2.2.1 ROS2案例以及案例分析
  • 使用 Python 访问 Windows 剪贴板
  • 手机空号过滤的多种应用场景
  • [Vue学习]生命周期及其各阶段举例
  • YOLOv5改进 | 损失函数 | EIoU、SIoU、WIoU、DIoU、FocuSIoU等多种损失函数
  • [leetcode]minimum-absolute-difference-in-bst 二叉搜索树的最小绝对差
  • [ALSA]从零开始,使用ALSA驱动播放一个音频
  • 自动化设备上位机设计 一
  • tampermonkey插件下载国家标准文件
  • JAVA学习笔记2
  • Unity 解包工具(AssetStudio/UtinyRipper)
  • log4j2 对定时异步线程打印的日志进行过滤
  • Oracle内部bug导致的19c DG备库宕机
  • 2024 世界人工智能大会暨人工智能全球治理高级别会议全体会议在上海举办,推动智能向善造福全人类
  • 【算法专题--栈】用栈实现队列 -- 高频面试题(图文详解,小白一看就懂!!)
  • 2024亚太杯中文赛B题全保姆教程
  • 穿越光影,共赏中华瑰宝——皮影戏文化交流盛会
  • SQL常用经典语句大全