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

相关内容

热门资讯

黑科技ai代打"德扑... 黑科技ai代打"德扑自定义房间!外挂透明挂辅助软件(黑科技)透牌教程"确实存在有挂;德扑自定义房间软...
黑科技教程"微扑克a... 黑科技教程"微扑克ai胜率!外挂透明挂辅助系统(黑科技)辅助教程"真是真的有挂1、很好的工具软件,可...
黑科技辅助"wpk德... 黑科技辅助"wpk德州ai辅助神器!外挂透明挂辅助神器(黑科技)透牌教程"确实有挂1、玩家可以在wp...
黑科技玄学"wepo... 黑科技玄学"wepoke一定有挂!外挂透明挂辅助下载(黑科技)教你教程"好像真的是有挂;1)wepo...
黑科技规律"aapo... 黑科技规律"aapoker辅助工具存在吗!外挂透明挂辅助挂(黑科技)德州论坛"果然是有挂1、aapo...
黑科技脚本"德扑之星... 黑科技脚本"德扑之星数据解析!外挂透明挂辅助助手(黑科技)玩家教你"果然存在有挂;1、很好的工具软件...
黑科技真的"wepo... 黑科技真的"wepoke软件靠谱吗!外挂透明挂辅助工具(黑科技)2025新版教程"本来真的有挂wep...
黑科技有挂"云扑克辅... 黑科技有挂"云扑克辅助挂!外挂透明挂辅助软件(黑科技)专业教程"本来真的是有挂;1、云扑克辅助挂系统...
黑科技辅助"wepo... 黑科技辅助"wepoke中牌率!外挂透明挂辅助脚本(黑科技)AI教程"本来有挂;wepoke中牌率辅...
黑科技能赢"wepo... 黑科技能赢"wepower有外挂!外挂透明挂辅助系统(黑科技)攻略方法"好像真的是有挂1、实时wep...