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

相关内容

热门资讯

透视辅助!wepoker是不是... wepoker是不是有人用挂是一款专注玩家量身打造的游戏记牌类型软件,在wepoker是不是有人用挂...
透视辅助!wepoker免费脚... wepoker辅助器如何使用开挂教程视频分享装挂详细步骤在当今的网络游戏中,wepoker辅助器如何...
透视辅助!pokerworld... 透视辅助!pokerworld软件,hhpoker辅助靠谱吗,传授开挂辅助神器(透视有挂功能);无需...
透视辅助!wepoker有没有... 您好:这款wepoker有没有辅助游戏是可以开挂的,确实是有挂的,很多玩家在这款wepoker有没有...
透视辅助!wepoker挂,w... 透视辅助!wepoker挂,wpk模拟器多开,实测开挂辅助脚本(透视有挂方针)【无需打开直接搜索加薇...
透视辅助!智星德州辅助译码插件... 透视辅助!智星德州辅助译码插件靠谱吗,hhpoker辅助软件是真的么,必看开挂辅助插件(透视有挂方法...
透视辅助!wepoker好友局... 透视辅助!wepoker好友局透视,购买的wpk辅助在哪里下载,曝光开挂辅助插件(透视有挂工具),购...
透视辅助!hhpoker免费辅... 您好:hhpoker免费辅助器这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多...
透视辅助!wepoker底牌透... 透视辅助!wepoker底牌透视,约局吧能不能开挂,分享开挂辅助下载(透视有挂功能) 了解更多开挂安...
透视辅助!德州私人局怎么透视,... 透视辅助!德州私人局怎么透视,拱趴大菠萝万能辅助器,分析开挂辅助工具(透视有挂方略);无需打开直接搜...