Let be a generic grayscale image.
The value of pixel
in the integral image
represents the sum of the values of all pixels in the source image contained within the rectangle
:
| (1.140) |
The computational trick of using the integral image makes it possible to optimize several algorithms presented in this book, in particular SURF (Section 6.4) and Haar feature extraction (Section 7.1).
Using the integral image, the sum over any rectangular subregion of image can be computed at a constant computational cost of four additions:
| (1.141) |
The value obtained in this way represents the sum of the elements of the original image within the rectangle, including its boundaries.
In addition to allowing the sum over any subregion of the image to be computed quickly, the integral image also makes it easy to perform convolutions with kernels of particular shapes, with computational performance independent of filter size. Examples of convolution masks can be found in Section 7.1.
Paolo medici