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实现人脸识别算法

相关内容

热门资讯

关于辅助!德州hhpoker脚... 关于辅助!德州hhpoker脚本,佛手在线辅助器安卓,开挂(透视)辅助工具(证实有挂);佛手在线辅助...
辅助透视!收集微乐小程序游戏破... 《辅助透视!收集微乐小程序游戏破解器,天酷辅助器(透视)开挂辅助安装微扑克教程》 辅助透视!收集微乐...
第9分钟开挂"传送屋... 第9分钟开挂"传送屋激k如何开启透视"起初有开挂透视辅助脚本(有挂教学);小薇(透视辅助)致您一封信...
传授辅助!德州局透视脚本免费版... 传授辅助!德州局透视脚本免费版下载手机版,闲聚app辅助软件,(透视)2026教程(揭秘有挂);人气...
推荐辅助!wepoker辅助器... 推荐辅助!wepoker辅助器免费,赣牌圈破解器,开挂(透视)辅助下载(真的有挂);wepoker辅...
透视了解!天天爱柳州辅助器,九... 透视了解!天天爱柳州辅助器,九酷众游辅助(透视)开挂辅助软件必备教程;透视了解!天天爱柳州辅助器,九...
第8分钟辅助"多乐找... 第8分钟辅助"多乐找刺激捕鱼辅助"原生有透视开挂辅助平台(有挂讲解);是一款可以让一直输的玩家,快速...
曝光辅助!wepoker辅助方... 曝光辅助!wepoker辅助方法,约战武汉辅助软件,(透视)攻略教程(有挂攻略);是一款可以让一直输...
科技辅助!wepoker好友局... 科技辅助!wepoker好友局透视,赤峰对调同城游辅助,开挂(透视)辅助平台(真是有挂);小薇(透视...
透视透视!微信小程序有挂吗辅助... 透视透视!微信小程序有挂吗辅助,新荣耀房卡辅助(透视)开挂辅助挂专业教程;1、完成透视透视!微信小程...