Face detection

Now, before we go ahead and detect faces, we need to tell the robot what a face is and what it looks like. Raspberry Pi does not know how exactly to classify a face from a pumpkin. So firstly, we would be using a dataset to tell the robot what our face looks like; thereafter, we will start recognizing the faces as we go. So let's go ahead and see how to do it.

Firstly, you need to install a dependency called Haar-cascade. This is a cascade-dependent algorithm that is used to detect objects rapidly. To do this, go ahead and run the following syntax on your terminal:

git clone https://github.com/opencv/opencv/tree/master/data/haarcascades

This will save the haarcascades file onto your Raspberry Pi and you will be ready to use ...

Get Python Robotics Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.