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

相关内容

热门资讯

黑科技安卓版(WePoKe)德... 黑科技安卓版(WePoKe)德州app系统(智能ai)本来是真的有挂(2022已更新)(哔哩哔哩)1...
黑科技辅助(wepokeai代... 黑科技辅助(wepokeai代打逻辑)外挂透明挂辅助插件(透视)原来是真的有挂(有挂分析)-哔哩哔哩...
热点讨论!德州扑克线上ai代打... 热点讨论!德州扑克线上ai代打(ai代打)解说技巧(2022已更新)(哔哩哔哩)是一款可以让一直输的...
黑科技挂黑科技(WePoKe)... 黑科技挂黑科技(WePoKe)wepoke最新下载地址(透明挂)原来存在有挂(2024已更新)(哔哩...
黑科技软件(wepoke游戏辅... 黑科技软件(wepoke游戏辅助工具)外挂透明挂辅助助手(透视)果然存在有挂(有挂讲解)-哔哩哔哩1...
必看攻略!!来玩德州app外挂... 必看攻略!!来玩德州app外挂(ai辅助)2025教程(2024已更新)(哔哩哔哩)来玩德州app外...
黑科技工具(WePoKe)we... 黑科技工具(WePoKe)wepoke软件透明挂(智能ai)切实是真的有挂(2026已更新)(哔哩哔...
黑科技ai(德扑线上有机器人吗... 黑科技ai(德扑线上有机器人吗)外挂透明挂辅助工具(透视)本来是真的有挂(有挂方法)-哔哩哔哩1)德...
研究成果!wepoke系统(透... 研究成果!wepoke系统(透视)教你攻略(2026已更新)(哔哩哔哩),您好,wepoke系统这款...
黑科技模拟器(WePoKe)a... 黑科技模拟器(WePoKe)aapoker透明挂下载(辅助挂)其实真的有挂(2021已更新)(哔哩哔...