9 Face-following camera

 

This chapter covers

  • Using the OpenCV library to detect faces in images
  • Measuring and optimizing face detection performance
  • Performing face detection in live videos
  • Using servo motors to make a face-following camera

This chapter will first show how to use the OpenCV library to detect faces in images. Then, we will extend this functionality to detecting faces in a live video stream and measure and optimize our face detection process. Once we have a fast face detection mechanism in place, we will create an application to perform face detection in a live video stream. The last part of the chapter includes creating an application that can detect face movements and move the camera with motors in the direction of the detected face. Face detection is a demanding computer vision activity using machine learning to detect faces.

9.1 Hardware stack

9.2 Software stack

9.3 Detecting faces in an image

9.3.1 Exploring face detection

9.3.2 Marking detected faces

9.4 Detecting faces in live video

9.4.1 Measuring face detection performance

9.4.2 Reducing the number of pixels to process

9.4.3 Optimizing face detection performance

9.4.4 Showing detected faces in live video

9.5 Creating a face-following robot

9.5.1 Zoning the face detection

9.5.2 Moving motors to follow faces

Summary