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

相关内容

热门资讯

透视挂!wepoker透视脚本... 透视挂!wepoker透视脚本下载(透视)外挂透明挂辅助机制(都是有挂);原来确实真的有挂(需添加指...
透视攻略!hhpoker怎么开... 透视攻略!hhpoker怎么开透视(透视)曝光教程(都是存在有挂)1、不需要AI权限,帮助你快速的进...
透视ai代打!we-poker... 透视ai代打!we-poker辅助,天天贵阳辅助工具,安装教程(有挂规律);1、让任何用户在无需天天...
透视私人局!智星德州菠萝安装(... 透视私人局!智星德州菠萝安装(透视)外挂透明挂辅助挂(素来真的有挂)准备好在 ia的高塔上攀登,扮演...
透视教学!aapoker可以开... 透视教学!aapoker可以开挂吗(透视)攻略方法(总是是真的有挂)1、金币登录送、破产送、升级送、...
透视ai!xpoker辅助助手... 透视ai!xpoker辅助助手,欢欢辅助软件怎么样,揭秘教程(有挂详情)1、操作简单,无需注册,只需...
透视攻略!hhpoker辅助器... 透视攻略!hhpoker辅助器(透视)外挂透明挂辅助插件(确实真的有挂)1、很好的工具软件,可以解锁...
透视插件!wepoker辅助下... 透视插件!wepoker辅助下载(透视)插件教程(都是真的是有挂)1、下载好wepoker辅助下载辅...
透视安卓版!德州透视hhpok... 透视安卓版!德州透视hhpoker,八闽掌上辅助软件,教你教程(有挂插件);暗藏猫腻,小编详细说明八...
透视智能ai!德普之星辅助器(... 透视智能ai!德普之星辅助器(透视)外挂透明挂辅助脚本(先前是有挂);德普之星辅助器软件透明挂作为一...