基础知识(十三)dlib python人脸检测
2016-05-03 21:28
627 查看
import cv2 import dlib import numpy as np #根据人脸框bbox,从一张完整图片裁剪出人脸 def getface(): bgrImg = cv2.imread('1.jpg') print bgrImg.shape rgbImg = cv2.cvtColor(bgrImg, cv2.COLOR_BGR2RGB) detector=dlib.get_frontal_face_detector() #img = io.imread('1.jpg') faces = detector(rgbImg, 1) if len(faces) > 0: face=max(faces, key=lambda rect: rect.width() * rect.height()) [x1,x2,y1,y2]=[face.left(),face.right(),face.top(),face.bottom()]
相关文章推荐
- 好文收藏(持续更新)
- Learning Spark (Python版) 学习笔记(二)----键值对、数据读取与保存、共享特性
- python获取指定时间差的时间
- python获取指定时间差的时间
- python 中文乱码问题
- Python json模块
- python 图片格式转换产生的锯齿问题
- python入门,自制小爬虫获得百度贴吧内容
- Python为什么这么火?
- 步步学习python之环境安装:Vagrant+Ubuntu+Emacs+Virtualenv+Python3开发环境的搭建(Mac电脑下)3
- ubuntu14中创建python虚拟环境
- 使用spyder编译器单步调试python
- 234. Palindrome Linked List [easy] (Python)
- python 模块
- Python pass 语句
- Python中函数参数设置及使用的学习笔记
- python 汉诺塔 Fibonacci数列
- 由PYTHONPATH谈起
- python 安装django
- Python制作统计图形