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

相关内容

热门资讯

我来教教你“拱趴大菠萝有挂吗”... 您好:这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好牌...
透视辅助!werplan辅助软... werplan辅助软件是一款专注玩家量身打造的游戏记牌类型软件,在werplan辅助软件这款游戏中我...
透视规律“wepoker钻石怎... 透视规律“wepoker钻石怎么看底牌”开挂(透视)辅助下载(微扑克教程有挂技巧) 【无需打开直接搜...
透视辅助!hhpoker德州透... 透视辅助!hhpoker德州透视,hhpoker是真的假的,传授开挂辅助平台(透视有挂解惑)>>您好...
重大消息“wpk私人局有透视吗... 重大消息“wpk私人局有透视吗”开挂(透视)辅助安装(微扑克教程有挂详情)ai黑科技系统规律教程开挂...
透视辅助!哈糖大菠萝有挂吗,p... 透视辅助!哈糖大菠萝有挂吗,pokemmo内置修改器,正品开挂辅助神器(透视有挂解惑);亲,哈糖大菠...
推荐十款“智星德州可以透视吗”... 您好:这款游戏是可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好...
透视辅助!wepoker的辅助... 透视辅助!wepoker的辅助器,约局吧开挂神器是真的吗,分享开挂辅助安装(透视的确有挂) >>您好...
透视辅助!werplan怎么透... 透视辅助!werplan怎么透视,pokemmo脚本,科技开挂辅助脚本(透视真的有挂)【无需打开直接...
大家学习交流“wejoker辅... 大家学习交流“wejoker辅助器怎么卖”开挂(透视)辅助脚本(可靠技巧有挂方式);无需打开直接搜索...