Python 人脸检测、面部五官关键点检测等 您所在的位置:网站首页 人脸的五官到底是哪五关 Python 人脸检测、面部五官关键点检测等

Python 人脸检测、面部五官关键点检测等

2023-11-10 20:32| 来源: 网络整理| 查看: 265

模块:face_recognition

import face_recognitio 官方描述: face_recognition是一个强大、简单、易上手的人脸识别开源项目,并且配备了完整的开发文档和应用案例,特别是兼容树莓派系统。本项目是世界上最简洁的人脸识别库,你可以使用Python和命令行工具提取、识别、操作人脸。本项目的人脸识别是基于业内领先的C++开源库 dlib中的深度学习模型,用Labeled Faces in the Wild人脸数据集进行测试,有高达99.38%的准确率。但对小孩和亚洲人脸的识别准确率尚待提升。

 依赖项

1. pip install cmake 2. pip install boost 3. pip install dlib

 

简单用法:

import face_recognition import cv2 # 读取图像数据 image = face_recognition.load_image_file(‘。。。’) # 获取图像中所有人脸的五官坐标 face_locations = face_recognition.face_landmarks(image) print('face_locations', face_locations) # 人脸检测 face_locations = face_recognition.face_locations(image, model="cnn") y_min, x_max, y_max, x_min = face_locations[0] cv2.rectangle(image, (x_min, y_min), (x_max, y_max), (0, 0, 255), 2) # 摄像头五官检测 names = ['left_eyebrow', 'right_eyebrow', 'nose_bridge', 'nose_tip', 'top_lip', 'bottom_lip', 'left_eye', 'right_eye'] cap = cv2.VideoCapture(0) while True: ret, frame = cap.read() # 获取图像中所有人脸的五官坐标 face_locations = face_recognition.face_landmarks(frame) points = face_locations[0] for name in names: for point in points[name]: cv2.circle(frame, point, 1, (0, 0, 255), -1) if cv2.waitKey(1) == 27: break cv2.imshow('Test camera', frame)

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有