当前位置:网站首页>face_recognition人脸检测
face_recognition人脸检测
2022-04-23 06:10:00 【林-金鹏】
原理
face_recognition是最简单的人脸识别库,该模型的准确率为 99.38%
代码仅需要三行:
import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_locations = face_recognition.face_locations(image)
一、效果预览
face_locations 返回图片上所有人脸的坐标位置,配合cv2库在图片上将所有坐标画出来。
二、实现过程
import face_recognition
import cv2
#加载图片
image = face_recognition.load_image_file("1.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()
版权声明
本文为[林-金鹏]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_46105038/article/details/120725072
边栏推荐
- MySQL notes 5_ Operation data
- Recyclerview batch update view: notifyitemrangeinserted, notifyitemrangeremoved, notifyitemrangechanged
- cmder中文乱码问题
- [2021 book recommendation] Red Hat Certified Engineer (RHCE) Study Guide
- Encapsulate a set of project network request framework from 0
- BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
- Oracle锁表查询和解锁方法
- useReducer基本用法
- ThreadLocal,看我就够了!
- iTOP4412无法显示开机动画(4.0.3_r1)
猜你喜欢
[2021 book recommendation] effortless app development with Oracle visual builder
Encapsulate a set of project network request framework from 0
Itop4412 LCD backlight drive (PWM)
接口幂等性问题
Android interview Online Economic encyclopedia [constantly updating...]
项目,怎么打包
Miscellaneous learning
Project, how to package
What did you do during the internship
Oracle Job定时任务的使用详解
随机推荐
谷歌AdMob广告学习
ffmpeg常用命令
MySQL notes 5_ Operation data
MySQL5. 7 insert Chinese data and report an error: ` incorrect string value: '\ xb8 \ XDF \ AE \ xf9 \ X80 at row 1`
Three methods to realize the rotation of ImageView with its own center as the origin
Itop4412 cannot display boot animation (4.0.3_r1)
Google AdMob advertising learning
Android room database quick start
adb shell常用模拟按键keycode
【2021年新书推荐】Artificial Intelligence for IoT Cookbook
项目,怎么打包
实习做了啥
ProcessBuilder工具类
oracle中生成32位uuid
同时解决高度塌陷和外边距重叠问题
第三篇:docker安装mysql容器(自定义端口)
【2021年新书推荐】Practical Node-RED Programming
cmder中文乱码问题
Itop4412 LCD backlight drive (PWM)
[recommendation for new books in 2021] professional azure SQL managed database administration