We will now discuss how to handle videos and retrain our human pose estimation network. We have already covered face detection and how to apply a model to a video. Opening a video is pretty straightforward and OpenCV provides a mechanism for that. It's basically doing the same thing one frame at a time. The following example shows the code for this:
predictor_path = "./shape_predictor_68_face_landmarks.dat"
detector = dlib.get_fronta1_face_detector()
predictor = dlib.shape_predictor(predictor_path)
#Uncomment Line below if you want to use your webcam
#cap = cv2.VideoCapture(0) #0 is the first camera on your computer, change if you
#more than one camera
#Comment out the Line below if using webcam
cap = cv2.VideoCapture('./rollerc.mp4')
figure(100)
font = cv2.FONT_HERSHEY_SIMPLEX
First, we need to create a cv2 capture device...