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透明黑科技!wep... wepoke透明黑科技!wepoke辅助从哪里下载(WePoKe黑科技)原来真的是有挂(的确有挂)-...
德州ai辅助软件!德州ai智能... 德州ai辅助软件!德州ai智能系统,(德州之星)总是真的是有挂,wepoke教程(有挂攻略)-哔哩哔...
发现一款"aa po... 发现一款"aa poker有外挂吗"aapoker辅助是什么(本来真的是有挂)-哔哩哔哩1)aapo...
wpK最新黑科技!wpk智能a... wpK最新黑科技!wpk智能ai(WPK ai辅助)从前真的有挂(2026已更新)(哔哩哔哩)1、构...
aapokerai辅助!aap... 新手教程相关信息汇总(需添加指定威信136704302获取下载链接);aapokerai辅助!aap...
wepoke真的有挂!wepo... wepoke真的有挂!wepoke有插件吗(WePoKe黑科技)好像有挂(有挂教程)-哔哩哔哩1、完...
玩家必看分享"aap... 玩家必看分享"aapokerai辅助"aapoker外挂(好像是真的有挂)-哔哩哔哩1、aapoke...
wpK最新黑科技!wpk系统发... 1、wpK最新黑科技!wpk系统发牌规律(WPK ai辅助)起初真的有挂(2020已更新)(哔哩哔哩...
wepoke智能ai!wepo... wepoke智能ai!wepoke透技巧,(Wepoke)原来真的是有挂,黑科技app(有挂解密)-...
wepoke智能ai!wepo... wepoke智能ai!wepoke有辅助挂(WePoKe黑科技)真是存在有挂(有挂教学)-哔哩哔哩;...