Summed-area Table
   HOME

TheInfoList



OR:

A summed-area table is a
data structure In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
and
algorithm In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
for quickly and efficiently generating the sum of values in a rectangular subset of a grid. In the
image processing An image or picture is a visual representation. An image can be two-dimensional, such as a drawing, painting, or photograph, or three-dimensional, such as a carving or sculpture. Images may be displayed through other media, including a pr ...
domain, it is also known as an integral image. It was introduced to
computer graphics Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
in 1984 by Frank Crow for use with
mipmap In computer graphics, a mipmap (''mip'' being an acronym of the Latin phrase ''multum in parvo'', meaning "much in little") is a pre-calculated, optimized sequence of images, each of which has an image resolution which is a factor of two small ...
s. In
computer vision Computer vision tasks include methods for image sensor, acquiring, Image processing, processing, Image analysis, analyzing, and understanding digital images, and extraction of high-dimensional data from the real world in order to produce numerical ...
it was popularized by Lewis and then given the name "integral image" and prominently used within the Viola–Jones object detection framework in 2001. 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 function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Ever ...
s.


The algorithm

As the name suggests, the value at any point (''x'', ''y'') in the summed-area table is the sum of all the pixels above and to the left of (''x'', ''y''), inclusive: I(x,y) = \sum_ i(x',y') where i(x,y) is the value of the pixel at (''x'',''y''). The summed-area table can be computed efficiently in a single pass over the image, as the value in the summed-area table at (''x'', ''y'') is just: I(x,y) = i(x,y) + I(x,y-1) + I(x-1,y) - I(x-1,y-1) (Noted that the summed matrix is calculated from top left corner) Once the summed-area table has been computed, evaluating the sum of intensities over any rectangular area requires exactly four array references regardless of the area size. That is, the notation in the figure at right, having , , and , the sum of over the rectangle spanned by ''A'', ''B'', ''C,'' and ''D'' is: \sum_ i(x,y) = I(D) + I(A) - I(B) - I(C)


Extensions

This method is naturally extended to continuous domains. The method can be also extended to high-dimensional images. If the corners of the rectangle are x^p with p in \^d, then the sum of image values contained in the rectangle are computed with the formula \sum_(-1)^ I(x^p) where I(x) is the integral image at x and d the image dimension. The notation x^p correspond in the example to d=2, A=x^, B=x^, C=x^ and D=x^. In
neuroimaging Neuroimaging is the use of quantitative (computational) techniques to study the neuroanatomy, structure and function of the central nervous system, developed as an objective way of scientifically studying the healthy human brain in a non-invasive ...
, for example, the images have dimension d=3 or d=4, when using
voxel In computing, a voxel is a representation of a value on a three-dimensional regular grid, akin to the two-dimensional pixel. Voxels are frequently used in the Data visualization, visualization and analysis of medical imaging, medical and scient ...
s or voxels with a time-stamp. This method has been extended to high-order integral image as in the work of Phan et al. 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 In probability theory and statistics, variance is the expected value of the squared deviation from the mean of a random variable. The standard deviation (SD) is obtained as the square root of the variance. Variance is a measure of dispersion ...
or
standard deviation In statistics, the standard deviation is a measure of the amount of variation of the values of a variable about its Expected value, mean. A low standard Deviation (statistics), deviation indicates that the values tend to be close to the mean ( ...
of a block, we need two integral images: I(x,y) = \sum_ i(x',y') I^2(x,y) = \sum_ i^2(x',y') The variance is given by: \operatorname(X) = \frac \sum_^n (x_i - \mu)^2. Let S_1 and S_2 denote the summations of block ABCD of I and I^2, respectively. S_1 and S_2 are computed quickly by integral image. Now, we manipulate the variance equation as: \begin \operatorname(X) &= \frac \sum_^n \left(x_i^2 - 2 \mu x_i + \mu^2\right) \\ ex&= \frac \left sum_^n x_i^2 - 2 \sum_^n \mu x_i + \sum_^n \mu^2\right\\ ex&= \frac \left sum_^n x_i^2 - 2\sum_^n \mu x_i + n \mu^2\right\\ ex&= \frac \left sum_^n x_i^2 - 2 \mu \sum_^n x_i + n \mu^2\right\\ ex&= \frac \left _2 - 2 \frac S_1 + n \left(\frac\right)^2\right\\ ex&= \frac \left _2 - \frac\right\end Where \mu=S_1/n and S_2 = \sum_^n x_i^2. Similar to the estimation of the mean (\mu) and variance (\operatorname), which requires the integral images of the first and second power of the image respectively (i.e. I, I^2); manipulations similar to the ones mentioned above can be made to the third and fourth powers of the images (i.e. I^3(x,y), I^4(x,y).) for obtaining the skewness and kurtosis. But one important implementation detail that must be kept in mind for the above methods, as mentioned by F Shafait et al. is that of integer overflow occurring for the higher order integral images in case 32-bit integers are used.


Implementation considerations

{, class="wikitable infobox" style="width:209px;float:right;" ,
, - , Integral image (right half) of a 2-bit greyscale pixel art (left half), normalised and magnified for visibility The data type for the sums may need to be different from and larger than the data type used for the original values, in order to accommodate the largest expected sum without overflow. For floating-point data, error can be reduced using compensated summation.


See also

*
Prefix sum In computer science, the prefix sum, cumulative sum, inclusive scan, or simply scan of a sequence of numbers is a second sequence of numbers , the summation, sums of Prefix (computer science), prefixes (running totals) of the input sequence: : : : ...


References


External links


Summed table implementation in object detection
h2>

Lecture videos


An introduction to the theory behind the integral image algorithm

A demonstration to a continuous version of the integral image algorithm, from the Wolfram Demonstrations Project
Digital geometry Computer graphics data structures