Python实现人脸识别
创始人
2025-01-08 21:36:05
0

直接上代码:

import face_recognition import time from PIL import Image, ImageDraw def faceRecognition(fileName):       # 加载图片     image = face_recognition.load_image_file(fileName)      # 人脸定位     beginTime = time.time()     face_locations = face_recognition.face_locations(image)     image2 = Image.open(fileName)     pil_image = ImageDraw.Draw(image2)     for face_location in face_locations:               # 打印位置         top, right, bottom, left = face_location         print("A face is located at pixel location Top: {}, Left: {}, Bottom: {}, Right: {}".format(top, left, bottom, right))               # 红色的边框颜色         red_color =(255, 0, 0)         # 边框的宽度         border_width = 3         # 要画红框的坐标 (x, y, x+width, y+height)         box_coordinates = (left, top, right, bottom)         # 画红框         pil_image.rectangle(box_coordinates, width=border_width, outline=red_color)         # 人脸图         # face_image = image[top:bottom, left:right]         # pil_image = Image.fromarray(face_image)         # pil_image.show()     image2.show()  if __name__ == '__main__':     faceRecognition('10010.jpg')

运行效果为:

完整代码地址:Python实现人脸识别算法

相关内容

热门资讯

黑科技挂!wepoke 软件(... 黑科技挂!wepoke 软件(软件透明挂)太离谱了原来是有挂(2025已更新)(哔哩哔哩);1、we...
信息共享“德州免费辅助神器ap... 信息共享“德州免费辅助神器app”外挂透明挂辅助器(一向存在有挂)-哔哩哔哩1、这是跨平台的德州免费...
解密关于(wepower)po... 解密关于(wepower)pokerworld有挂吗(2021已更新)(哔哩哔哩)是一款可以让一直输...
透视ai“约局吧德州透视”详细... 透视ai“约局吧德州透视”详细透视辅助开挂曝光教程-其实真的有挂1、操作简单,无需注册,只需要使用手...
2分钟细说“蘑菇辅助网”太夸张... 2分钟细说“蘑菇辅助网”太夸张了透视辅助开挂透牌教程-原来是真的有挂1、玩家可以在蘑菇辅助网软件透明...
黑科技脚本!微扑克有挂(辅助挂... 黑科技脚本!微扑克有挂(辅助挂)太离谱了原来是有挂(2024已更新)(哔哩哔哩)1、微扑克有挂系统规...
终于知道“德州扑克线上ai代打... 终于知道“德州扑克线上ai代打”外挂透明挂辅助工具(都是存在有挂)-哔哩哔哩,支持语音通讯、好友开房...
重要通知(aapokER)微扑... 重要通知(aapokER)微扑克德州专用辅助器(2023已更新)(哔哩哔哩)1、玩家可以在微扑克德州...
透视智能ai“hhpoker脚... 透视智能ai“hhpoker脚本”详细透视辅助开挂透明挂教程-果然有挂1、任何hhpoker脚本ai...
记者揭秘“wpk有没有作弊”外... 记者揭秘“wpk有没有作弊”外挂透明挂辅助器(起初真的有挂)-哔哩哔哩;wpk有没有作弊简单的灵活控...