Loading...
Compute the integral image (summed-area table) of a 2D grayscale image.
The integral image I at position (i,j) is defined as the sum of all pixel values at or above row i and at or to the left of column j in the original image S:
I(i,j)=∑i′≤i∑j′≤jS(i′,j′)
The integral image can be computed efficiently using the recurrence:
I(i,j)=S(i,j)+I(i−1,j)+I(i,j−1)−I(i−1,j−1)
with I(i,j)=0 when i<0 or j<0.
Integral images are used extensively in computer vision for fast computation of rectangular region sums, enabling algorithms like Viola-Jones face detection and SURF feature detection.
image = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]][[1, 3, 6], [5, 12, 21], [12, 27, 45]]