pub fn integral_squared_image<P, T>(image: &Image<P>) -> Image<ChannelMap<P, T>>
Expand description
Computes the 2d running sum of the squares of the intensities in an image. Channels are summed independently.
See the integral_image
documentation for more information on integral images.
ยงExamples
use imageproc::integral_image::{integral_squared_image, sum_image_pixels};
let image = gray_image!(
1, 2, 3;
4, 5, 6);
let integral = gray_image!(type: u32,
0, 0, 0, 0;
0, 1, 5, 14;
0, 17, 46, 91);
assert_pixels_eq!(integral_squared_image::<_, u32>(&image), integral);
// Compute the sum of the squares of all pixels in the right two columns
assert_eq!(sum_image_pixels(&integral, 1, 0, 2, 1)[0], 4 + 9 + 25 + 36);
// Compute the sum of the squares of all pixels in the top row
assert_eq!(sum_image_pixels(&integral, 0, 0, 2, 0)[0], 1 + 4 + 9);