pub fn integral2(
src: &impl ToInputArray,
sum: &mut impl ToOutputArray,
sqsum: &mut impl ToOutputArray,
sdepth: i32,
sqdepth: i32
) -> Result<()>
Expand description
Calculates the integral of an image.
The function calculates one or more integral images for the source image as follows:
Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example:
It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently.
As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(4,4,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted .
§Parameters
- src: input image as
, 8-bit or floating-point (32f or 64f).
- sum: integral image as
, 32-bit integer or floating-point (32f or 64f).
- sqsum: integral image for squared pixel values; it is
, double-precision floating-point (64f) array.
- tilted: integral for the image rotated by 45 degrees; it is
array with the same data type as sum.
- sdepth: desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.
- sqdepth: desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
§Overloaded parameters
§C++ default parameters
- sdepth: -1
- sqdepth: -1