Let be a generic grayscale image.
The value of pixel
in the integral image
is the sum of the values of all pixels in the source image within the rectangle
:
| (1.140) |
Using the integral image is a computational trick that makes several algorithms described in this book more efficient, particularly SURF (Section 6.4) and Haar feature extraction (Section 7.1).
The integral image makes it possible to compute the sum over any rectangular subregion of the image at a constant computational cost of four additions:
| (1.141) |
The resulting value is the sum of the elements of the original image within the rectangle, including its endpoints.
In addition to quickly computing the sum over any subregion of the image, the integral image makes it easy to perform convolutions with kernels of particular shapes, with performance that is independent of the filter size. Examples of convolution masks are given in Section 7.1.
Paolo medici