当前位置:网站首页>人脸识别框架之dlib
人脸识别框架之dlib
2022-04-23 16:25:00 【andrew P】
1.人脸检测如下
import dlib
from imageio import imread
detector = dlib.get_frontal_face_detector()#检测器
predictor_path = 'shape_predictor_68_face_landmarks.dat'
predictor = dlib.shape_predictor(predictor_path)#预测器
win = dlib.image_window()
path ='111.jpg'
img = imread(path)
win.clear_overlay()
win.set_image(img)
# 1 表示将图片放大一倍,便于检测到更多人脸
dets = detector(img, 1)
print('检测到了 %d 个人脸' % len(dets))
for i, d in enumerate(dets):
print('- %d: Left %d Top %d Right %d Bottom %d' % (i, d.left(), d.top(), d.right(), d.bottom()))
shape = predictor(img, d)
# 第 0 个点和第 1 个点的坐标
print('Part 0: {}, Part 1: {}'.format(shape.part(0), shape.part(1)))
win.add_overlay(shape)
2.生成面部检测器
detector = dlib.get_frontal_face_detector()#检测器
3.生成特征预测器,68维度的
predictor_path = 'shape_predictor_68_face_landmarks.dat'
predictor = dlib.shape_predictor(predictor_path)#预测器
shape_predictor(landmark_model_path)
参数:landmark_model_path:68特征landmarks模型path
官方例子如下:
http://dlib.net/face_alignment.py.html
# Load all the models we need: a detector to find the faces, a shape predictor
# to find face landmarks so we can precisely localize the face
加载我们需要的所有模型:一个用于查找人脸的检测器,一个用于查找人脸标志的形状预测器,这样我们就可以精确定位人脸
4.开始检测
# 1 表示将图片放大一倍,便于检测到更多人脸
dets = detector(img, 1)
5.返回68个特征点
shape = predictor(img, d)
6.将特征点画到原来的图上
for i, d in enumerate(dets):
print('- %d: Left %d Top %d Right %d Bottom %d' % (i, d.left(), d.top(), d.right(), d.bottom()))
shape = predictor(img, d)
# 第 0 个点和第 1 个点的坐标
print('Part 0: {}, Part 1: {}'.format(shape.part(0), shape.part(1)))
win.add_overlay(shape)
结果
版权声明
本文为[andrew P]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41166909/article/details/124330874
边栏推荐
- JSP learning 3
- 捡起MATLAB的第(6)天
- Day (3) of picking up matlab
- 文件系统读写性能测试实战
- Construction of esp32 compilation environment
- Es common query, sorting and aggregation statements
- G008-HWY-CC-ESTOR-04 华为 Dorado V6 存储仿真器配置
- TIA botu - basic operation
- Introduction notes to PHP zero Foundation (13): array related functions
- 05 Lua control structure
猜你喜欢
Oak-d raspberry pie cloud project [with detailed code]
Read the meaning of serial port and various level signals
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
Hypermotion cloud migration completes Alibaba cloud proprietary cloud product ecological integration certification
Hypermotion cloud migration helped China Unicom. Qingyun completed the cloud project of a central enterprise and accelerated the cloud process of the group's core business system
451. 根据字符出现频率排序
下载并安装MongoDB
MySQL - MySQL查询语句的执行过程
Download and install mongodb
How magical is the unsafe class used by all major frameworks?
随机推荐
Download and install mongodb
Nacos 详解,有点东西
OAK-D树莓派点云项目【附详细代码】
Jour (9) de ramassage de MATLAB
Gartner 發布新興技術研究:深入洞悉元宇宙
Esxi encapsulated network card driver
Algorithem_ ReverseLinkedList
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
Gartner announces emerging technology research: insight into the meta universe
JSP learning 1
Day (6) of picking up matlab
GRBL学习(二)
Summary according to classification in sail software
MySQL的btree索引和hash索引区别
Win11 / 10 home edition disables the edge's private browsing function
RecyclerView advanced use - to realize drag and drop function of imitation Alipay menu edit page
How to conduct application security test (AST)
Sortby use of spark operator
Day (8) of picking up matlab
The most detailed Backpack issues!!!