当前位置:网站首页>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
边栏推荐
- Component based learning (1) idea and Implementation
- Android room database quick start
- Binder mechanism principle
- 【2021年新书推荐】Enterprise Application Development with C# 9 and .NET 5
- Cancel remote dependency and use local dependency
- 【2021年新书推荐】Practical Node-RED Programming
- 组件化学习(2)Arouter原理学习
- 三种实现ImageView以自身中心为原点旋转的方法
- 统一任务分发调度执行框架
- 基于BottomNavigationView实现底部导航栏
猜你喜欢
SSL/TLS应用示例
Viewpager2 realizes Gallery effect. After notifydatasetchanged, pagetransformer displays abnormal interface deformation
iTOP4412 LCD背光驱动(PWM)
Android清除应用缓存
Cause: dx. jar is missing
Oracle Job定时任务的使用详解
【2021年新书推荐】Professional Azure SQL Managed Database Administration
个人博客网站搭建
oracle表的约束详解
[2021 book recommendation] effortless app development with Oracle visual builder
随机推荐
【2021年新书推荐】Practical IoT Hacking
HandlerThread原理和实际应用
接口幂等性问题
adb shell 常用命令
oracle数据库将多个列的查询结果集合并到一行中
iTOP4412 FramebufferNativeWindow(4.0.3_r1)
[exynos4412] [itop4412] [android-k] add product options
MySQL5.7插入中文数据,报错:`Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1`
组件化学习(2)Arouter原理学习
Android interview Online Economic encyclopedia [constantly updating...]
数据库的事务
Oracle锁表查询和解锁方法
[Andorid] 通过JNI实现kernel与app进行spi通讯
一款png生成webp,gif, apng,同时支持webp,gif, apng转化的工具iSparta
oracle生成毫秒级时间戳
Itop4412 HDMI display (4.4.4_r1)
基于BottomNavigationView实现底部导航栏
Binder机制原理
ffmpeg常用命令
Binder mechanism principle