Implementing face image processing
We will use mainly two Python libraries – dlib and OpenCV – to implement most of the face processing tasks. OpenCV is good for general-purpose computer vision tasks and includes low-level functions and algorithms. While dlib
was originally a C++ toolkit for machine learning, it also has a Python interface, and it is the go-to machine learning Python library for facial landmark detection. Most of the image processing code used in this chapter is adapted from https://github.com/deepfakes/faceswap.
Extracting image from video
The first thing in the production pipeline is to extract images from video. A video is made up of a series of images separated by a fixed time interval. If you check a video file's properties, you may find something that says frame rate = 25 fps. FPS indicates the number of image frames per second in a video, and 25 fps is the standard video frame rate. That means 25 images are played within a 1-second...