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

相关内容

热门资讯

透视透视挂!aapoker透视... 透视透视挂!aapoker透视方法(透视)ai插件(真是是真的有挂);1、玩家可以在aapoker透...
透视科技!aa poker辅助... 透视科技!aa poker辅助(透视)辅助器可以用(真是存在有挂)1、每一步都需要思考,不同水平的挑...
透视挂!aapoker发牌逻辑... 透视挂!aapoker发牌逻辑(透视)ai插件(确实是有挂)aapoker发牌逻辑辅助器中分为三种模...
透视中牌率!aapoker发牌... 透视中牌率!aapoker发牌逻辑(透视)可以控制牌(一直有挂)1、aapoker发牌逻辑机器人多个...
透视玄学!aapoker怎么设... 透视玄学!aapoker怎么设置提高好牌几率(透视)透视脚本入口(一贯真的是有挂)1、aapoker...
透视ai!aapoker安装包... 透视ai!aapoker安装包怎么使用(透视)辅助可以用(一直真的是有挂)1、首先打开aapoker...
透视教程!aapoker辅助器... 透视教程!aapoker辅助器是真的吗(透视)真的假的(切实存在有挂)所有人都在同一条线上,像星星一...
透视玄学!aapoker ai... 透视玄学!aapoker ai插件(透视)插件(切实是有挂)1、aapoker ai插件ai机器人多...
透视好友房!aapoker怎么... 透视好友房!aapoker怎么控制牌(透视)可以选牌(确实是有挂)1、点击下载安装,aapoker怎...
透视实锤!aapoker辅助软... 透视实锤!aapoker辅助软件合法吗(透视)脚本可以用(原来存在有挂);1、aapoker辅助软件...