# Automatic Outdoor Patrol Robot Based on Sensor Fusion and Face Recognition Methods
## 2 Materials and Methods
### Face Recognition
#### 2.5.1 Integral Image  
The rectangle features are shown in Figure 5a [37], and the value \(I(x,y)\) at point \((x,y)\) in the integral image is the sum of \(i(x^{\prime},y^{\prime})\) of all the pixels \((x^{\prime},y^{\prime})\) above and to the left of \((x,y)\), as shown in Figure 5b [37; 39; 40]. Its computation is very fast at any scale or location in constant time by using the integral image, which was proposed by [PERSON] in 1984.  
Figure 4: (a) Arduino UNO; (b) DFRduino I/O expansion board.  
Figure 3: The three wheels of an omnidirectional WMR.  
In Equation (5), \(I\) is the value of the pixel position in the integral image and \(i\) is the value of the pixel position in the original image.  
\[I(x,y)=\sum_{x^{\prime}\leq x,y^{\prime}\leq y^{\prime}}x\left(x^{\prime},y^{ \prime}\right) \tag{5}\]  
The integral of the image can be computed efficiently with one pass over the image, and the value at point (\(x\),\(y\)) is [39]:  
\[I(x,y)=i(x,y)-I(x-1,y-1)+I(x,y-1)+I(x-1,y) \tag{6}\]  
When the integral image has been computed, the rectangular sum can be computed in four array references regardless of the area size, as shown in Figure 6[37]. That sign in Figure 6, having 1 = (\(x_{0}\), \(y_{0}\)), 2 = (\(x_{1}\), \(y_{0}\)), 3 = (\(x_{0}\), \(y_{1}\)), and 4 = (\(x_{1}\), \(y_{1}\)), the sum of \(i\)(\(x\),\(y\)) over the rectangle spanned by 1, 2, 3 and 4 is [34]:  
\[\sum_{\begin{array}{c}x_{0}<x\leq x_{1}\\ y_{0}<y\leq y_{1}\end{array}}i(x,y)=I(4)+I(1)-I(2)-I(3) \tag{7}\]  
[PERSON] et al. proposed a novel set to rotate Haar-like features [35]. Their method has two assumptions, one is to assume that the basic unit for testing for the presence of an object is a window of W*H pixels, as shown in Figure 7[35; 36].  
Figure 5: (**a**) Each rectangle feature is a single value obtained by subtracting the sum of the pixels which lie within the white rectangles from the sum of pixels in the gray rectangles; (**b**) the value \(I(x,y)\) at point \((x,\ y)\) in the integral image is the sum of all the pixels above and to the left of \((x,\ y)\).  
Figure 6: The sum of the pixels within rectangle \(D\) can be computed with four array references.  
The other is to assume that they have a very fast way of computing the sum of pixels of an upright and 45\({}^{\circ}\) rotated rectangle inside the window. That can extend the original feature set, which is used by [PERSON] and [PERSON]. The calculation for 14 Haar-like features is very fast at any scale or location in a constant time, as shown in Figure 8 [35; 36]. Calculation of each feature is by summing up pixels [34; 40].  
\[feature_{I}=\sum_{i\in I=\{1,\cdots,N\}}\omega_{i}*RecSum(r_{i}) \tag{8}\]  
where \(w_{i}\) are the weights, \(r_{i}\) are the rectangles, and \(N\) is chosen arbitrarily. Only weighted combinations of pixel sums of two rectangles are considered, that is, \(N=2\). The weights have opposite signs and are used to compensate for the difference in area size between the two rectangles.  
At the 45\({}^{\circ}\) rotated rectangles, the value of the point (\(x\),\(y\)) in the integral image is the sum of extending upwards until the boundaries of the image and all the pixels of the bottom-most corner at point (\(x\),\(y\)), as shown in Figure 9 [36].  
\[R(x,y)=\sum_{y^{\prime}\leq y,\ y^{\prime}\leq y-|x-x^{\prime}|}I(x^{\prime}, y^{\prime}) \tag{9}\]  
Figure 8: The extended feature sets, wherein, the black and white areas correspond to positive and negative weights, respectively.  
Figure 7: The examples of upright and 45\({}^{\circ}\) rotated rectangles.  
Figure 9: The value at point \((x,\ y)\) in the integral image is the sum of all the pixels of the bottom-most corner at point \((x,\ y)\) and extending upwards until the boundaries of the image.  
Computation efficiently of the integral image can be performed with one pass over the image from left to right and top to bottom, as shown in Figure 10[36].  
\[R(x,y)=R(x-1,y-1)+R(x+1,y-1)-R(x,y-2)+I(x,y)+I(x,y-1) \tag{10}\]