CV:利用cv2+dlib库自带frontal_face_detector(人脸征检测器)实现人脸检测与人脸标记之《极限男人帮》和《NBA全明星球员》
生活随笔
收集整理的這篇文章主要介紹了
CV:利用cv2+dlib库自带frontal_face_detector(人脸征检测器)实现人脸检测与人脸标记之《极限男人帮》和《NBA全明星球员》
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
CV:利用cv2+dlib庫自帶frontal_face_detector(人臉征檢測器)實現人臉檢測與人臉標記之《極限男人幫》和《NBA全明星球員》
?
目錄
輸出結果
設計思路
實現代碼
相關模型下載
?
?
輸出結果
?
?
?
設計思路
?
實現代碼
import cv2 import dlib import numpy import sysPREDICTOR_PATH = "F:\File_Python\Resources\shape_predictor_68_face_landmarks.dat" detector = dlib.get_frontal_face_detector()predictor = dlib.shape_predictor(PREDICTOR_PATH)class NoFaces(Exception):passim = cv2.imread("F:\File_Python\Resources\Allstart.jpg")rects = detector(im,1)if len(rects) >= 1:print("{} faces detected".format(len(rects)))if len(rects) == 0:raise NoFacesfor i in range(len(rects)):landmarks = numpy.matrix([[p.x,p.y] for p in predictor(im,rects[i]).parts()])im = im.copy()for idx,point in enumerate(landmarks):pos = (point[0,0],point[0,1])#cv2.putText(im,str(idx),pos,#fontFace=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,#fontScale=0.4,#color=(0,0,255))cv2.circle(im,pos,0.5,color=(0,255,0)) cv2.namedWindow("im",2) cv2.imshow("im",im) cv2.waitKey(0)?
相關模型下載
Landmark人臉68個關鍵點檢測dat模型庫(shape_predictor_68_face_landmarks.dat)
?更多參考文獻
OpenCV:利用OpenCV+dlib庫實現對《極限男人幫》和《NBA全明星球員》人臉檢測與人臉標記
?
總結
以上是生活随笔為你收集整理的CV:利用cv2+dlib库自带frontal_face_detector(人脸征检测器)实现人脸检测与人脸标记之《极限男人帮》和《NBA全明星球员》的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 成功解决Building wheels
- 下一篇: DL框架之Keras:深度学习框架Ker