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透明黑科技)wepok系统规律解析(wEpoke)原来是真的有挂(有挂总结)...
黑科技智能ai(wepokea... 黑科技智能ai(wepokeai代打)wepoke俱乐部黑科技(WepokE)一贯真的是有挂(有挂教...
黑科技好友(wepoke智能a... 黑科技好友(wepoke智能ai)wepoke黑科技是啥(wEpOke)固有是有挂(有挂教程)-哔哩...
黑科技辅助挂(wepoke真的... 《软件透明挂》是一款多人竞技的辅助透视游戏,你将微扑克对手来到同一个战场,为至高无上的荣耀进行一次自...
黑科技辅助挂(wepoke智能... 黑科技辅助挂(wepoke智能ai)wepoke有辅助挂吗(wepOkE)素来有挂(真的有挂)-哔哩...
黑科技工具(wepoke黑科技... 黑科技工具(wepoke黑科技)wepoke透明挂在哪买(wepOKE)起初是有挂(有挂总结)-哔哩...
黑科技苹果版(wepoke辅助... 黑科技苹果版(wepoke辅助插件)wepoke辅助器真的有效果吗(wePoKe)素来真的有挂(有挂...
黑科技苹果版(wepoke智能... 这是一款非常优秀的 ia辅助检测软件,能够让你了解到中牌率当中全部隐藏参数,与同类被系统制裁软件相比...
黑科技挂(wepoke智能ai... WePoker透视辅助版本稳定性对比与推荐‌:黑科技挂(wepoke智能ai)wepoke辅助德之星...
黑科技辅助挂(wepokeai... 黑科技辅助挂(wepokeai代打)wepoke透明挂使用教程(wePokE)确实是有挂(有挂详情)...