dlibによる顔検出
869 ワード
dilib.get_frontal_face_detector()
det.left()
det.right()
det.top()
det.bottom()
det.left()
det.right()
det.top()
det.bottom()
import cv2
import dlib
detector = dlib.get_frontal_face_detector()
cap = cv2.VideoCapture('videos/01.mp4')
sticker_img = cv2.imread('imgs/stickers/sticker01.png', cv2.
IMREAD_UNCHANGED)
while True:
ret, img = cap.read()
if not ret:
break
dets = detector(img)
print("number of faces detected:", len(dets))
for det in dets:
x1 = det.left()
y1 = det.top()
x2 = det.right()
y2 = det.bottom()
cv2.rectangle(img, pt1=(x1, y1), pt2=(x2, y2), color=(0, 255, 0), thickness=2)
cv2.imshow('video', img)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()코드를 입력하세요
Reference
この問題について(dlibによる顔検出), 我々は、より多くの情報をここで見つけました https://velog.io/@thissa/dlib을-이용하여-얼굴-검출テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol