shape_predictor_81_face_landmarks.dat

上传者: hardinging | 上传时间: 2021-12-15 14:43:40 | 文件大小: 18.83MB | 文件类型: -
dlib人脸特征库分类器,81个点 包含使用代码,通过摄像头识别人脸 import cv2 import dlib from skimage import io import numpy as np # 使用特征提取器get_frontal_face_detector detector = dlib.get_frontal_face_detector() # dlib的68点模型,使用作者训练好的特征预测器 predictor = dlib.shape_predictor("shape_predictor_81_face_landmarks.dat") cap=cv2.VideoCapture(0) while True: ret,img=cap.read() dets = detector(img, 1) for k, d in enumerate(dets): print("第", k+1, "个人脸d的坐标:", "left:", d.left(), "right:", d.right(), "top:", d.top(), "bottom:", d.bottom()) width = d.right() - d.left() heigth = d.bottom() - d.top() print('人脸面积为:',(width*heigth)) # 利用预测器预测 #shape = predictor(img, d) cv2.rectangle(img,(d.left(),d.top()),(d.right(),d.bottom()),(0,255,0),1) shape = predictor(img, d) landmarks = np.matrix([[p.x, p.y] for p in shape.parts()]) for num in range(shape.num_parts): cv2.circle(img, (shape.parts()[num].x, shape.parts()[num].y), 3, (0,255,0), -1) #cv2.putText(img, str(i), (shape.part(i).x, shape.part(i).y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255)) cv2.imshow("img",img) if cv2.waitKey(1) & 0xFF == ord('q'): break

文件下载

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明