# Summed area table

A **summed area table** is a data structure and algorithm for quickly and efficiently generating the sum of values in a rectangular subset of a grid. In the image processing domain, it is also known as an **integral image**. It was first introduced to computer graphics in 1984 by Frank Crow for use with mipmaps. In computer vision it was first prominently used within the Viola–Jones object detection framework in 2001. However, historically, this principle is very well known in the study of multi-dimensional probability distribution functions, namely in computing 2D (or ND) probabilities (area under the probability distribution) from the respective cumulative distribution functions.^{[1]}

## The algorithm

As the name suggests, the value at any point (*x*, *y*) in the summed area table is just the sum of all the pixels above and to the left of (*x*, *y*), inclusive:^{[2]}^{[3]}

Moreover, the summed area table can be computed efficiently in a single pass over the image, using the fact that the value in the summed area table at (*x*, *y*) is just:

Once the summed area table has been computed, the task of evaluating any rectangle can be accomplished in constant time with just four array references. Specifically, using the notation in the figure at right, having A=(x0, y0), B=(x1, y0), C=(x0, y1) and D=(x1, y1), the sum of over the rectangle spanned by A, B,C and D is just

## Extensions

- This method is naturally extended to continuous domains.
^{[1]}

- The method can be also extended to high-dimensional images.
^{[4]}If the corners of the rectangle are with in , then the sum of image values contained in the rectangle are computed with the formula

where is the integral image at and the image dimension. The notation correspond in the example to , , , and . In neuroimaging, for example, the images have dimension or , when using voxels or voxels with a time-stamp.

- This method has been extended to high-order integral image as in the work of Phan et al.
^{[5]}who provided two, three, or four integral images for quickly and efficiently calculating the standard deviation (variance), skewness, and kurtosis of local block in the image. This is detailed below:

To compute variance or standard deviation of a block, we need two integral images:

The variance is given by:

Let and denote the summations of block of and , respectively. and are computed quickly by integral image. Now, we manipulate the variance equation as:

Similar to the estimation of the mean () and variance (), which requires the integral images of the first and second power of the image respectively (i.e. ); manipulations similar to the ones mentioned above can be made to the third and fourth powers of the images (i.e .) for obtaining the skewness and kurtosis.^{[5]}
But one important implementation detail that must be kept in mind for the above methods, as mentioned by F Shafait et al. ^{[6]} is that of integer overflow occurring for the higher order integral images in case 32-bit integers are used.

## References

- ↑
^{1.0}^{1.1}{{#invoke:citation/CS1|citation |CitationClass=conference }} - ↑ {{#invoke:citation/CS1|citation |CitationClass=conference }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=conference }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑
^{5.0}^{5.1}{{#invoke:Citation/CS1|citation |CitationClass=journal }} - ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}

## External links

- Lecture videos