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

相关内容

热门资讯

专业讨论!德扑之星真破解套路(... 专业讨论!德扑之星真破解套路(辅助挂)软件透明挂(有挂了解)-哔哩哔哩;人气非常高,ai更新快且高清...
每日必看!智星德州菠萝外挂检测... 每日必看!智星德州菠萝外挂检测(辅助挂)软件透明挂(有挂教学)-哔哩哔哩1、玩家可以在智星德州菠萝外...
透视透明挂!轰趴十三水有后台(... 轰趴十三水有后台赢率提升策略‌;透视透明挂!轰趴十三水有后台(辅助挂)软件透明挂(有挂详情)-哔哩哔...
发现玩家!德扑ai助手软件(辅... 发现玩家!德扑ai助手软件(辅助挂)透视辅助(有挂教学)-哔哩哔哩;玩家在德扑ai助手软件中需先进行...
一分钟了解!x-poker辅助... 一分钟了解!x-poker辅助软件(辅助挂)辅助透视(有挂攻略)-哔哩哔哩1、每一步都需要思考,不同...
一分钟揭秘!德州最新辅助器(辅... 一分钟揭秘!德州最新辅助器(辅助挂)透视辅助(有挂攻略)-哔哩哔哩;德州最新辅助器最新版本免费下载安...
玩家攻略推荐!德州辅助(辅助挂... 玩家攻略推荐!德州辅助(辅助挂)辅助透视(有挂了解)-哔哩哔哩是由北京得德州辅助黑科技有限公司精心研...
揭秘真相!pokernow德州... 《揭秘真相!pokernow德州(辅助挂)辅助透视(有挂介绍)-哔哩哔哩》 pokernow德州软件...
五分钟了解!德州之星辅助器(辅... 五分钟了解!德州之星辅助器(辅助挂)辅助透视(有挂透明)-哔哩哔哩1、很好的工具软件,可以解锁游戏的...
推荐一款!pokermaste... 1、推荐一款!pokermaster有外挂(辅助挂)透视辅助(有挂教学)-哔哩哔哩;详细教程。2、p...