人生苦短,我用python实现人脸(口罩)识别(几十行代码搞定)
2023-09-14 09:07:03 时间
import face_recognition
import cv2
#加载图片
image = face_recognition.load_image_file("image/LYF.jpg")
#识别图片上所有人脸的位置
face_locations = face_recognition.face_locations(image)
img = cv2.imread("1.jpg", cv2.IMREAD_COLOR)
for i in face_locations:
#face_locations 返回参数位置说明 (top, right, bottom, left)
top = i[0]
right = i[1]
bottom = i[2]
left = i[3]
# param 1:图片
# param 2:左上角坐标
# param 3:右下角坐标
# param 方框颜色
# 方框大小
cv2.rectangle(img, (left, top), (right, bottom), (255, 255, 255), 2)
# 显示图片
cv2.imshow("1.jpg", img)
# 保存为新文件
cv2.imwrite("new.jpg", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
相关文章
- python skitlearn_Python sklearn
- 终于来了, 彭涛Python 爬虫训练营 !爬虫课福利进行中,务必不要错过!
- python识别文字位置_如何利用Python识别图片中的文字
- python进制转换函数-Python中进制转换函数的使用
- python海龟作图红绿灯_海龟作图—用Python绘图
- python 之 内置函数大全[通俗易懂]
- 70行Python代码,获取中国数据库大会(DTCC)全部PPT
- python attrs_Python attrs作用是什么?
- python开发mbus程序_Mbus 2019(水表校验程序)V2.1 最新版
- Python 生成随机数_python 随机字符串
- 利用python进行数学公式识别
- python-Python与MongoDB数据库-处理MongoDB查询结果
- Ubuntu18.04 一键升级Python所有第三方包 及安装python包的方法
- python 操作 ssh详解编程语言
- Python中识别DataFrame中的nan详解编程语言
- Python脚本实现Linux系统管理及自动化部署(python写linux)
- python驱动使用pip安装MySQL Python驱动的简单步骤(pip安装mysql)
- Python如何连接MySQL数据库(python怎么连接mysql数据库)
- 让python命令行也可以自动补全