欢迎关注博主的公众号:happyGirl的异想世界。有更多干货还有技术讨论群哦~

dlib.get_frontal_face_datector(PythonFunction,in Classes)

其中in Classes 表示采样(upsample)次数

返回值是<class 'dlib.dlib.rectangle'>,就是一个矩形

坐标为[(x1, y1) (x2, y2)]

可以通过函数的left,right,top,bottom方法分别获取对应的x1, x2, y1, y2值:

import cv2
import dlib
img = cv2.imread('my_image.jpg')
detector = dlib.get_frontal_face_detetor()dets = detector(gray_img, 1)
for i, d in enumerate(dets):print(type(d))y1 = d.top() if d.top() > 0 else 0y2 = d.bottom() if d.bottom() > 0 else 0x1 = d.left() if d.left() > 0 else 0x2 = d.right() if d.right() > 0 else 0

enumerate函数的返回值是迭代对象的索引和对应值

i:矩形索引

d:矩形坐标值

in Classes 暂时还没明白,但是找到的一些资料里都是写的1,如果哪位大牛知道是什么意思,还希望不吝赐教!

最后打印一下就会得到相对应的值。这里要说明一下,当使用d.area()函数计算面积的时候,数值是包含起始点的坐标的:

x = x2 - x1 + 1
y = y2 - y1 + 1
d.area() = x * y

参考文献:

https://blog.csdn.net/weixin_41789707/article/details/79798224

dlib.get_frontal_face_detector()函数相关推荐

  1. dlib.get_frontal_face_detector()函数返回值

    IT小白的第一篇博客 dlib.get_frontal_face_datector(PythonFunction,in Classes) 返回值是<class 'dlib.dlib.rectan ...

  2. dlib.get_frontal_face_detector()及detector()返回值

    目录 1.结论 2.验证过程 2.1代码 2.2数据:传入图片(必应搜索获取) 2.3输出结果 3.参考致谢 1.结论 detector=dlib.get_frontal_face_detector( ...

  3. dlib.get_frontal_face_detector(), Python format 格式化函数 predictor(img, dets[0])

    detector = dlib.get_frontal_face_detector() # 人脸检测dets = detector(img, 1)# len(dets) 即为检测到的人脸个数print ...

  4. dlib.get_frontal_face_detector()批量预测

    问题:怎么使用dlib.get_frontal_face_detector()批量预测自己划分的验证数据集? 代码: #author:wu #导入需要的库 import cv2 import dlib ...

  5. detector = dlib.get_frontal_face_detector()获取人脸框的用法

    detector = dlib.get_frontal_face_detector() #功能:人脸检测画框 #参数:无 #返回值:默认的人脸检测器 faces = detector(img_gray ...

  6. dlib.get_frontal_face_detector()人脸检测

    detector = dlib.get_frontal_face_detector() #功能:人脸检测画框 #参数:无 #返回值:默认的人脸检测器 faces = detector(img_gray ...

  7. dlib.get_frontal_face_detector() AttributeError: module ‘dlib’ has no attribute ‘get_frontal_face_de

    环境 Win10 python3.7 python原生环境 与人脸识别有关的库多适配python3.6,方法三中就将python改成了3.6版本 方法一(无效) 因为你没有下载人脸库shape_pre ...

  8. Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

    Py之dlib:Python库之dlib库的简介.安装.使用方法详细攻略 目录 dlib库的简介 dlib库的安装 dlib库的使用函数 0.利用dlib.get_frontal_face_detec ...

  9. CV:计算机视觉技最强学习路线之CV简介(传统视觉技术/相关概念)、早期/中期/近期应用领域(偏具体应用)、经典CNN架构(偏具体算法)概述、常用工具/库/框架/产品、环境安装、常用数据集、编程技巧

    CV:计算机视觉技最强学习路线之CV简介(传统视觉技术/相关概念).早期/中期/近期应用领域(偏具体应用).经典CNN架构(偏具体算法)概述.常用工具/库/框架/产品.环境安装.常用数据集.编程技巧 ...

最新文章

  1. 变量作用域函数作用域
  2. python教学网站-python学习网站整理
  3. [小结]硬盘分区的知识与意义
  4. Hadoop详解(九):Hadoop Streaming和Pipes原理和实现
  5. windows设备坐标和逻辑坐标的转换
  6. 当前FreeBSD的版本
  7. html中的波浪线,CSS3 波浪线
  8. await Task传异步Lambda问题
  9. 第一款Layer 2钱包Rollups Wallet已上线苹果AppStore
  10. uboot环境变量(设置bootargs向linux内核传递正确的参数)
  11. 最长上升子序列o(nlogn)复杂度一种简单易懂的理解
  12. Android视频加密
  13. 数学建模常用模型简介其他模型大全汇总
  14. [html] img标签的alt属性
  15. 树莓派配置文件 config.txt - HDMI 热插拔
  16. h5活动是什么意思_H5活动页面可以有哪些作用
  17. 中国IT工作者35岁后的发展出路调查报告
  18. kali2020.3安装openvas(gvm11)附gvm修改amdin密码以及gvm创建账号
  19. 关于“无穷”的概念---数学笔记“无穷”
  20. 异常解决:java.lang.IllegalStateException: Failed to introspect Class

热门文章

  1. 有关浏览器教程:开启加速模式
  2. 【Linux、进程隐藏】在Linux环境下添加系统调用实现进程隐藏
  3. 关闭笔记本自带的键盘
  4. Monkey测试—真机测试步骤
  5. 五类、超五类、六类跳线
  6. ACW 835. Trie字符串统计
  7. .dll、.lib、.dll.a 的区别
  8. 手写PE结构解析工具
  9. 从空间中理解线性代数
  10. 内网环境发送统计数据到企业微信