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

相关内容

热门资讯

透视实锤!哈糖大菠萝助手,竞技... 透视实锤!哈糖大菠萝助手,竞技联盟辅助(原来真的有挂);1、打开软件启动之后找到中间准星的标志长按。...
透视安装!德普之星透视软件免费... 透视安装!德普之星透视软件免费入口官网(透视)透视辅助软件下载(都是有挂);亲,关键说明,德普之星透...
透视辅助!werplan透视挂... 透视辅助!werplan透视挂,拱趴大菠萝有什么挂(其实真的是有挂)1、拱趴大菠萝有什么挂ai辅助优...
透视科技!德普之星app安卓版... 透视科技!德普之星app安卓版破解版(透视)辅助软件(本来有挂)进入游戏-大厅左侧-新手福利-激活码...
透视规律!werplan免费挂... 透视规律!werplan免费挂下载,线上德州的辅助器是什么(本来存在有挂)1)线上德州的辅助器是什么...
透视有挂!如何下载德普之星辅助... 透视有挂!如何下载德普之星辅助软件(透视)免费透视(总是有挂)1、如何下载德普之星辅助软件ai辅助优...
透视挂透视!xpoker透视辅... 透视挂透视!xpoker透视辅助,拱趴游戏破解器(原来真的是有挂)1、拱趴游戏破解器ai辅助优化,拱...
透视ai代打!德扑圈透视挂(透... 透视ai代打!德扑圈透视挂(透视)辅助器app(确实存在有挂)1、在德扑圈透视挂ai机器人技巧中,中...
透视免费!xpoker辅助工具... 透视免费!xpoker辅助工具,werplan外卦神器(一贯真的是有挂)1、每一步都需要思考,不同水...
透视工具!德普之星辅助工具如何... 透视工具!德普之星辅助工具如何设置(透视)私人局辅助免费(都是是真的有挂)1、每一步都需要思考,不同...