java.lang.Object
imagingbook.common.image.IntegralImage
This class represents an 'integral image' or 'summed area table' as proposed in [1], See Sec. 2.8 of [2] for a
detailed description. Currently only implemented for images of type ByteProcessor.
[1] F. C. Crow. Summed-area tables for texture mapping. SIGGRAPH, Computer Graphics 18(3), 207–212 (1984).
[2] W.
Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Version:
- 2022/07/11
-
Constructor Summary
ConstructorsConstructorDescriptionIntegralImage(int[][] I) Constructor, creates a newIntegralImageinstance from pixel values in a 2D int-array I[x][y].Constructor, creates a newIntegralImageinstance from pixel values in the specifiedByteProcessor. -
Method Summary
Modifier and TypeMethodDescriptionlonggetBlockSum1(int ua, int va, int ub, int vb) Calculates the sum of the pixel values in the rectangle R, specified by the corner points a = (ua, va) and b = (ub, vb).longgetBlockSum2(int ua, int va, int ub, int vb) Calculates the sum of the squared pixel values in the rectangle R, specified by the corner points a = (ua, va) and b = (ub, vb).doublegetMean(int ua, int va, int ub, int vb) Calculates the mean of the image values in the specified rectangle.long[][]getS1()Returns the summed area table of pixel values (Σ1).long[][]getS2()Returns the summed area table of squared pixel values (Σ2).intgetSize(int ua, int va, int ub, int vb) Returns the size of (number of pixels in) the specified rectangle.doublegetVariance(int ua, int va, int ub, int vb) Calculates the variance of the image values in the specified rectangle. parameters.
-
Constructor Details
-
IntegralImage
Constructor, creates a newIntegralImageinstance from pixel values in a 2D int-array I[x][y].- Parameters:
I- pixel values
-
IntegralImage
Constructor, creates a newIntegralImageinstance from pixel values in the specifiedByteProcessor.- Parameters:
I- input image
-
-
Method Details
-
getS1
Returns the summed area table of pixel values (Σ1).- Returns:
- array of Σ1 values
-
getS2
Returns the summed area table of squared pixel values (Σ2).- Returns:
- array of Σ2 values
-
getBlockSum1
Calculates the sum of the pixel values in the rectangle R, specified by the corner points a = (ua, va) and b = (ub, vb).- Parameters:
ua- leftmost position in Rva- top position in Rub- rightmost position in Rvb- bottom position in R- Returns:
- the first-order block sum (S1(R)) inside the specified rectangle or zero if the rectangle is empty.
-
getBlockSum2
Calculates the sum of the squared pixel values in the rectangle R, specified by the corner points a = (ua, va) and b = (ub, vb).- Parameters:
ua- leftmost position in Rva- top position in Rub- rightmost position in Rvb- bottom position in R- Returns:
- the second-order block sum (S2(R)) inside the specified rectangle or zero if the rectangle is empty.
-
getSize
Returns the size of (number of pixels in) the specified rectangle.- Parameters:
ua- leftmost position in Rva- top position in Rub- rightmost position in R (ub >= ua)vb- bottom position in R (vb >= va)- Returns:
- the size of the specified rectangle
-
getMean
Calculates the mean of the image values in the specified rectangle.- Parameters:
ua- leftmost position in Rva- top position in Rub- rightmost position in R (ub >= ua)vb- bottom position in R (vb >= va)- Returns:
- the mean value for the specified rectangle
-
getVariance
Calculates the variance of the image values in the specified rectangle. parameters.- Parameters:
ua- leftmost position in Rva- top position in Rub- rightmost position in R (u1 >= u0)vb- bottom position in R (v1 >= v0)- Returns:
- the variance for the specified rectangle
-