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

相关内容

热门资讯

第五分钟了解!微乐江西小程序辅... 第五分钟了解!微乐江西小程序辅助器免费插件开挂,小闲巴渝辅助软件透视挂(最新版本2026)1、每一步...
玩家必看分享“wepoker透... 玩家必看分享“wepoker透视挂真的假的”(透视)详细开挂辅助教程wepoker中的透视功能是一项...
1分钟透视挂!新九哥脚本,美猴... 1分钟透视挂!新九哥脚本,美猴王房卡辅助(微信链接金花辅助开挂app)1、下载好美猴王房卡辅助辅助软...
黑科技辅助(德扑数据)外挂软件... 黑科技辅助(德扑数据)外挂软件透明挂智能ai代打辅助app(透视)技巧教程(2024已更新)(哔哩哔...
黑科技游戏!德州wpk辅助是否... 黑科技游戏!德州wpk辅助是否真实存在,太坑了本然有挂(2020已更新)(哔哩哔哩);1、点击下载安...
三分钟了解!朋朋政和麻将为什么... 三分钟了解!朋朋政和麻将为什么一直输插件开挂,杭州边锋网络游戏辅助软件透视挂(最新版本2026)杭州...
一分钟了解“wepokerpl... 一分钟了解“wepokerplus辅助”(透视)详细开挂辅助教程wepoker透视模式为玩家提供了一...
7分钟透视挂!人海大厅挂件怎么... 7分钟透视挂!人海大厅挂件怎么买,海米大厅辅助(微信链接拼十辅助开挂工具)进入游戏-大厅左侧-新手福...
黑科技辅助(WPK技巧)外挂软... 黑科技辅助(WPK技巧)外挂软件透明挂智能ai代打辅助器(透视)可靠教程(2021已更新)(哔哩哔哩...
今日头条!wepoke透明挂件... 今日头条!wepoke透明挂件,太坑了本来是真的有挂(2026已更新)(哔哩哔哩);wepoke透明...