pub fn variance(
    integral_image: &Image<Luma<u32>>,
    integral_squared_image: &Image<Luma<u32>>,
    left: u32,
    top: u32,
    right: u32,
    bottom: u32,
) -> f64 {
    // TODO: same improvements as for sum_image_pixels, plus check that the given rect is valid.
    let n = (right - left + 1) as f64 * (bottom - top + 1) as f64;
    let sum_sq = sum_image_pixels(integral_squared_image, left, top, right, bottom)[0];
    let sum = sum_image_pixels(integral_image, left, top, right, bottom)[0];
    (sum_sq as f64 - (sum as f64).powi(2) / n) / n
}
Computes the variance of [left, right] * [top, bottom] in F, where `integral_image` is the
integral image of F and `integral_squared_image` is the integral image of the squares of the
pixels in F.

See the [`integral_image()`] documentation for more information on integral images.

# Examples
```
# extern crate image;
# #[macro_use]
# extern crate imageproc;
# fn main() {
use std::f64;
use imageproc::integral_image::{integral_image, integral_squared_image, variance};

let image = gray_image!(
1, 2, 3;
4, 5, 6);

let integral = integral_image(&image);
let integral_squared = integral_squared_image(&image);

// Compute the variance of the pixels in the right two columns
let mean: f64 = (2.0 + 3.0 + 5.0 + 6.0) / 4.0;
let var = ((2.0 - mean).powi(2)
+ (3.0 - mean).powi(2)
+ (5.0 - mean).powi(2)
+ (6.0 - mean).powi(2)) / 4.0;

assert_eq!(variance(&integral, &integral_squared, 1, 0, 2, 1), var);
# }
```
src/integral_image.rs