/Facial-Recognition

Facial Recognition on Raspberry Pi 4B with OpenCV

Primary LanguagePythonMIT LicenseMIT

Facial Recognition with OpenCV

 OpenCV is an open-source computer vision library supported by Intel. As a basic open-source project for computer vision, image processing and pattern recognition. It uses a face detector called Haar Cascade Classifier, which uses data stored in an XML file to determine the location of each local search image and detects it using its built-in function, which uses a Cascade Classifier trained on a target object to find rectangular regions in the image containing the target object and returns these regions as a sequence of rectangular boxes, with the final detection result stored in a variable.

 Haar features shown in the below image are used. They are just like convolutional kernels. Each feature is a single value obtained by subtracting sum of pixels under the white rectangle from sum of pixels under the black rectangle.

  

 Consider the image above on the right. The top row shows two good features. The first feature selected seems to focus on the property that the region of the eyes is often darker than the region of the nose and cheeks. The second feature selected relies on the property that the eyes are darker than the bridge of the nose. [1]

 Considering that the task we want to implement is relatively simple, the size of the dataset is relatively small, and the performance of Raspberry Pi is not enough for fast deep learning, so I used OpenCV-based face recognition. The QT library is used to develop the graphical interface under Raspbian (extended version of Debian), and the OpenCV image processing library is used as the basis to carry out various processes using the relevant functions provided in the library: image data are collected by the camera, face detection uses the trained Haar classifier to pattern match the collected images, and the detection results can be used for face image training and identity recognition.

  I have successfully built a car with a Raspberry Pi camera and hope to use convolutional neural networks in the future to achieve fully autonomous driving capabilities. Below I provided all the parts to build the car along with its workflow.

  

Simulations

4 Predisents 6 Presidents

Reference

[1]: OpenCV: Cascade Classifier