The example will continue to use a Script CHOP, Python and TouchDesigner for a face detection function. Instead of using the MediaPipe library, it will use the Dlib Python binding. It refers to the face detector example program from the Dlib distribution. Dlib is a popular C++ based programming toolkit for various applications. Its image processing library contains a number of face detection functions. Python binding is also available.
The main face detection capability is defined in the following statements.
import dlib detector = dlib.get_frontal_face_detector() rects = detector(image, 0)
The Script CHOP will generate the following channels
- cx (centre of the rectangle – horizontal)
- cy (centre of the rectangle – vertical)
- width
- height
for the largest face it detected from the live image.
The complete project is available in the FaceDetectionDlib1 GitHub folder.