# Personal Identification Using Embedded Raspberry Pi-Based Face Recognition Systems
## 2 Materials and Methods
### Face Classification
#### 2.6.2 Cascading Haar Classifier  
The Haar cascade classifier is a machine learning algorithm for object detection in images or video files. It is based on the concept of features proposed by [PERSON] and  
Figure 6: Graph of the dependency of the classifier weight on the error rate. [PERSON] in their 2001 paper \"Rapid Object Detection using a Boosted Cascade of Simple Features\". This approach involves training the cascade function with many positive and negative images, which is then used to detect objects in other images. The algorithm consists of the following steps:  
* The selection of Haar-like features;
* The creation of integral images;
* Training with the AdaBoost algorithm;
* The formation of cascade classifiers. Initially, the algorithm requires many positive images (with faces) and negative images (without faces) to train the classifier. Next, Haar-like features are extracted. Each feature is a single value obtained by subtracting the sum of pixels under the white rectangle from the sum of pixels under the black rectangle. These features consider the neighboring areas at a specific location in the window and the intensity of pixels in each region and calculate the difference in sums. There are several types of Haar-like features (Figure 7a), each designed to capture different patterns in the image:  
* Edge Features: These features detect edges by comparing the sum of pixel intensities in two adjacent rectangular regions. For example, a vertical edge feature might compare the sum of pixels on the left side of a rectangle with the sum of pixels on the right side. * Line Features: These features detect lines by comparing the sum of pixel intensities in three adjacent rectangular regions. For example, a horizontal line feature might compare the sum of pixels in the top, middle, and bottom regions of a rectangle. * Four-Rectangle Features: These features detect diagonal patterns by comparing the sum of pixel intensities in four rectangular regions arranged in a grid. To calculate a Haar-like feature, you subtract the sum of pixel intensities in the white regions from the sum of pixel intensities in the black regions. This can be achieved efficiently using an integral image. The integral image \(I\) at a location (\(x\),\(y\)) is defined as the sum of all pixel values above and to the left of (\(x\),\(y\)):  
\[I(x,y)=\sum_{x^{\prime}\leq x,\ y^{\prime}\leq y}i(x^{\prime},\ y^{\prime}) \tag{7}\]  
where \(i(x^{\prime},y^{\prime})\) is the pixel value at \((x^{\prime},y^{\prime})\). Using the integral image, the sum of pixel values in any rectangular region can be computed in constant time, which significantly speeds up the calculation of Haar-like features. Each feature's possible sizes and locations are used to calculate many functions. For example, a 24 \(\times\) 24-pixel window can generate over 160,000 features. The sums of pixels under the white and black rectangles are calculated for each feature. During the detection phase, the target image window is moved over the input image, and Haar-like features are computed for each image sub-section. However, among all the calculated features, most of them are insignificant. In Figure 7b, you can see that the top row shows  
Figure 7: Haar features (**a**); positive Haar-like features on a face image example (**b**) [67]. two positive features: the first selected feature seems to focus on the property that the eye region is often darker than the nose and cheeks area. The second feature chosen finds a darker eye area than the nose bridge area. The same windows applied to the cheeks are already insignificant. This is because the top row (Figure 7b) represents biometric features of the face, while shaded areas on the cheeks are not distinguishing features between faces. AdaBoost learning algorithms are used to differentiate significant features from insignificant ones. To this end, we apply each feature to all training images. For each feature, the best threshold is found to classify faces as positive or negative.