Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from imutils import face_utils
- import numpy as np
- import argparse
- import imutils
- import dlib
- import cv2
- import time
- from imutils.video import VideoStream
- detector = dlib.get_frontal_face_detector()
- predictor = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat')
- vs = cv2.VideoCapture('Video Downloader Pro-1.mp4')
- time.sleep(2.0)
- while True:
- ret, frame = vs.read()
- #frame = imutils.resize(frame, width=400)
- gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
- rects = detector(gray, 0)
- for rect in rects:
- shape = predictor(gray, rect)
- shape = face_utils.shape_to_np(shape)
- for (x, y) in shape:
- cv2.circle(frame, (x, y), 1, (0, 0, 255), -1)
- cv2.imshow("Frame", frame)
- key = cv2.waitKey(1) & 0xFF
- if key == ord("q"):
- break
- cv2.destroyAllWindows()
- vs.stop()
Advertisement
Add Comment
Please, Sign In to add comment