skimage2.transform.integrate#

skimage2.transform.integrate(ii, start, end)[source]#

Use an integral image to integrate over a given window.

Parameters:
iindarray

Integral image.

startList of tuples, each tuple of length equal to dimension of ii

Coordinates of top left corner of window(s). Each tuple in the list contains the starting row, col, … index i.e [(row_win1, col_win1, ...), (row_win2, col_win2,...), ...].

endList of tuples, each tuple of length equal to dimension of ii

Coordinates of bottom right corner of window(s). Each tuple in the list containing the end row, col, … index i.e [(row_win1, col_win1, ...), (row_win2, col_win2, ...), ...].

Returns:
Sscalar or ndarray

Integral (sum) over the given window(s).

See also

integral_image

Create an integral image / summed area table.

Examples

>>> from _skimage2.transform import integral_image
>>> arr = np.ones((5, 6), dtype=float)
>>> ii = integral_image(arr)
>>> integrate(ii, (1, 0), (1, 2))  # sum from (1, 0) to (1, 2)
array([3.])
>>> integrate(ii, [(3, 3)], [(4, 5)])  # sum from (3, 3) to (4, 5)
array([6.])
>>> # sum from (1, 0) to (1, 2) and from (3, 3) to (4, 5)
>>> integrate(ii, [(1, 0), (3, 3)], [(1, 2), (4, 5)])
array([3., 6.])