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

相关内容

热门资讯

了解开挂“对战互娱辅助系统”附... 大家好,今天小编来为大家解答对战互娱辅助系统这个问题咨询软件客服可以免费测试直接加微信(136704...
通报透视!wepoker怎么下... 通报透视!wepoker怎么下载游戏,wepoker究竟有没有透视(附辅助开挂脚本);wepoker...
开挂盘点!cloudpoker... 开挂盘点!cloudpoker怎么开挂(透视)蜀山四川小程序辅助(一分钟教会你辅助开挂脚本)蜀山四川...
发现透视!wepoker透视挂... 发现透视!wepoker透视挂底牌,werplan怎么辅助(附开挂辅助神器);超受欢迎的wepoke...
实测开挂“微信小程序财神十三章... 实测开挂“微信小程序财神十三章特殊牌”附开挂辅助神器(最新通报有挂分析);无需打开直接搜索加薇136...
辅助详细!hhpoker一直输... >>您好:凑一桌关春天怎么开透视确实是有挂的,很多玩家在这款凑一桌关春天怎么开透视游戏中打牌都会发现...
原来有辅助“哈局八张模拟器”附... 哈局八张模拟器开挂教程视频分享装挂详细步骤在当今的网络游戏中,哈局八张模拟器作为一种经典的娱乐方式,...
教会透视!德普之星透视,德普之... 教会透视!德普之星透视,德普之星透视辅助软件下载(附开挂辅助插件);1、很好的德普之星透视辅助软件下...
辅助推荐!aa poker辅助... 辅助推荐!aa poker辅助(透视)九游破解辅助插件官网(终于清楚开挂辅助软件)九游破解辅助插件官...
通报透视!xpoker辅助控制... 通报透视!xpoker辅助控制,wepoker游戏安装教程(附辅助开挂神器);小薇(透视辅助)致您一...