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透视怎么用,aapoker俱乐部靠谱吗(透视)详细教程(确实有挂)1.a...
热点推荐!微扑克有脚本,wop... 热点推荐!微扑克有脚本,wopoker游戏辅助器,透明挂教程(有挂规律)-哔哩哔哩;人气非常高,ai...
5分钟指导!安装不了wepok... 5分钟指导!安装不了wepoker,德普之星透视辅助ios(透视)2025版教程(有挂规律)1、德普...
黑科技存在!德扑之星隐藏功能,... 黑科技存在!德扑之星隐藏功能,微扑克辅助钻石,安装教程(有挂教程)-哔哩哔哩;致您一封信;亲爱德扑之...
五分钟俱乐部!aapoker透... 五分钟俱乐部!aapoker透视脚本入口,wepoker私人辅助器(透视)攻略方法(有挂技巧)亲,关...
玩家爆料!微扑克必胜技巧,微扑... 玩家爆料!微扑克必胜技巧,微扑克辅助是真的,揭秘教程(有挂教程)-哔哩哔哩;亲,有的,ai轻松简单,...
五分钟熟悉!智星德州菠萝插件官... 五分钟熟悉!智星德州菠萝插件官网,hhpoker透视脚本(透视)可靠教程(有挂攻略)1、智星德州菠萝...
来一盘!wepoke有辅助挂,... 来一盘!wepoke有辅助挂,wpk发牌逻辑,科技教程(今日头条)-哔哩哔哩;wepoke有辅助挂A...
第六分钟领会!wepoker挂... 第六分钟领会!wepoker挂,wepoker辅助器下载(透视)力荐教程(存在有挂)1、wepoke...
插件辅助挂!微扑克代打,德州之... 插件辅助挂!微扑克代打,德州之星辅助器多少钱,wepoke教程(有挂工具)-哔哩哔哩;1、让任何用户...