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

相关内容

热门资讯

5分钟透视!wepoker透视... 5分钟透视!wepoker透视有没有,wpk透视挂(透视)专业教程(详细教程)5分钟透视!wepok...
五分钟透明挂!德州局透视,聚星... 五分钟透明挂!德州局透视,聚星ai辅助工具下载(透视)技巧教程(有挂方法)1、完成聚星ai辅助工具下...
八分钟科普!werplan透视... 八分钟科普!werplan透视挂,红龙poker透视挂指令(透视)实用技巧(有挂助手)1、不需要AI...
第6分钟私人局!德普之星透视辅... 第6分钟私人局!德普之星透视辅助软件下载,德普之星辅助软件(透视)AI教程(发现有挂)1、让任何用户...
八分钟透视!竞技联盟辅助,xp... 八分钟透视!竞技联盟辅助,xpoker透视辅助(透视)2025新版(确实有挂)1、进入到竞技联盟辅助...
七分钟透明挂!德州透视是真的假... 七分钟透明挂!德州透视是真的假的,hhpoker透视脚本视频(透视)必备教程(果真有挂)1、德州透视...
4分钟知晓!wpk透视辅助方法... 4分钟知晓!wpk透视辅助方法,pokernow辅助控制(透视)2025新版技巧(今日头条)wpk透...
四分钟知晓!哈糖大菠萝助手,p... 四分钟知晓!哈糖大菠萝助手,pokemmo手机版脚本免费(透视)可靠技巧(真实有挂)1、上手简单,内...
第4分钟透明挂!德普之星app... 第4分钟透明挂!德普之星app安卓版破解版,大菠萝789辅助器下载(透视)科技教程(果真有挂)进入游...
第四分钟辅助挂!epoker免... 第四分钟辅助挂!epoker免费透视脚本,pokemmo手机版修改器(透视)安装教程(有挂教程)po...