Dlib + python + opencv 实时人脸68特征点提取
来源:互联网 发布:淘宝刷单工作室 编辑:程序博客网 时间:2024/05/18 15:25
1.安装libboost:
sudo apt-get install libbost-python-dev cmake2.安装dlib。首先去官网(http://dlib.net/)下载dlib,解压后在根目录可以看到setup.py文件,在此目录下运行:
sudo python setup.py install如没有添加权限可能会出现“error: can't create or remove files”这样的错误。
进入python环境,输入:
import dlib无异常提示,则安装成功。
3.安装skimage:
sudo apt-get install python-skimage4.下载 landmark的模型:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
非常简洁的代码:
import cv2import dlibcap=cv2.VideoCapture(0)predictor_path = "shape_predictor_68_face_landmarks.dat"predictor = dlib.shape_predictor(predictor_path)detector = dlib.get_frontal_face_detector()while True: _,frame=cap.read() # Ask the detector to find the bounding boxes of each face. The 1 in the # second argument indicates that we should upsample the image 1 time. This # will make everything bigger and allow us to detect more faces. dets = detector(frame, 1) if len(dets) != 0: # Get the landmarks/parts for the face in box d. shape = predictor(frame, dets[0]) for p in shape.parts(): cv2.circle(frame, (p.x, p.y), 3, (0,0,0), -1) cv2.imshow('video',frame) if cv2.waitKey(1)&0xFF==27: breakcap.release()cv2.destroyAllWindows()如果要识别多个人脸,将
if len(dets) != 0:改为:
for i in range(len(dets)):PS:如遇报错:RuntimeError: Unsupported image type, must be 8bit gray or RGB image,可能是摄像头没装好,我用的USB摄像头,有个地方接触不良,会经常遇到这样的报错。
阅读全文
0 0
- Dlib + python + opencv 实时人脸68特征点提取
- Dlib提取人脸特征点(68点,opencv画图)
- Dlib提取人脸特征点(68点,opencv画图)
- 【Python】dlib实现视频中人脸68特征点提取
- 【Python】使用openCV与dlib实现人脸68特征点的检测与手动修改
- 用dlib和opencv进行不同角度人脸检测及68个关键点提取(Python)
- Dlib+opencv实时提取人脸轮廓(windows环境下//Dlib配置入门)
- opencv结合dlib进行人脸特征点的检测
- 利用dlib库(Python)实现实时(摄像头)人脸检测以及特征点标定(landmark))
- 基础知识(十三)dlib python人脸检测 特征点定位
- python dlib学习(二):人脸特征点标定
- python dlib学习(七):人脸特征点对齐
- dlib python人脸检测 特征点定位
- 人脸检测、提取特征点(dlib下的三个例子)
- VS2013+Dlib提取特征点使用总结
- 人脸关键点提取(dlib)
- dlib人脸特征点对齐
- 人脸旋转归一化 (根据特征点定位,dlib+opencv)
- spring事务隔离、传播
- HTML5全局属性汇总
- iPhone X 如何根据状态栏上的图标 获取设备的联网状态(不是单个应用的)
- SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置
- 5. Longest Palindromic Substring
- Dlib + python + opencv 实时人脸68特征点提取
- 数据结构 第五周项目二 建立链栈算法库
- RocketMQ实战(二)
- caffe版本-车型检测-A Large-Scale Car Dataset for Fine-Grained Categorization and Verification
- 从0开始学习SpringCould(7)--SpringBoot 多环境配置
- Leetcode Two Maximum Subarray Questions
- 链路层--计算机网络自顶向下笔记(五)
- Day018
- 分答项目_技能点:移动端domobile***参数