# Little doubt about the face detection operation using Haar cascades

I don't quite understand how the pixels are summed in each rectangle area described here: Face Detection using Haar Cascades

It says:

Each feature is a single value obtained by subtracting sum of pixels under white rectangle from sum of pixels under black rectangle.

What are summed in each region (rectangle)? The number of pixels or the intensity of all pixels in that region?

this shows, how to get the sum of 1 rectangle in an integral image

Thanks @berak. So, the value for the rectangle area is calculated based on the integral image, and each value from the integral image, in turn, is generated from the sum of all pixels (intensity) in the up-left from the original image. Is that right? If it is right, the answer to my question is that it uses the intensity of the pixels to calculate the rectangles value.

Now I have another doubt, about the integral image. It uses the intensity of the current pixel to generate the corresponding value (x,y) for the integral image?

For example:

|10|15|

|18|20|

Original

|10|25|

|28|63|

Integral

Is that correct?