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辅助脚本是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户可以...
传授开挂"wepok... 传授开挂"wepoker可以免费玩吗"wepoker有没有机器人(透视)开挂辅助平台(真的有挂);无...
透视辅助!wepoker看底牌... 透视辅助!wepoker看底牌,哈糖大菠萝怎么开挂,传授开挂辅助插件(透视的确有挂) >>您好:软件...
曝光辅助"we-po... 曝光辅助"we-poker辅助器"aapoker怎么开辅助器(透视)开挂辅助插件(有挂工具)>>您好...
玩家必备教程“德普之星怎么开辅... 玩家必备教程“德普之星怎么开辅助”开挂(透视)辅助软件(AI教程竟然有挂);无需打开直接搜索薇:13...
透视辅助!pokemmo脚本辅... 透视辅助!pokemmo脚本辅助,xpoker辅助工具,分享开挂辅助安装(透视确实有挂)pokemm...
盘点透视"wepok... 盘点透视"wepoker透视脚本苹果版"pokerrrr2辅助(透视)开挂辅助插件(竟然有挂);无需...
透视脚本“wepoker辅助软... 较多好评“微乐万能挂官网”开挂(透视)辅助教程 了解更多开挂安装加(136704302)微信号是一款...
透视辅助!hhpoker真的假... 透视辅助!hhpoker真的假的,hhpoker俱乐部是干嘛的,细节开挂辅助下载(透视的确有挂);无...
曝光透视"wepok... 曝光透视"wepoker轻量版有透视吗"wepoker永久免费脚本(透视)开挂辅助工具(有挂技巧);...