[][src]Function simplecv::filter::mean_smooth

pub fn mean_smooth<S>(
    src: &ArrayBase<S, Ix2>,
    ksize: usize,
    border: BorderType
) -> Array<f64, Ix2> where
    S: Data<Elem = f64>, 

Smooth the image with a mean kernel.

  • ksize: is the kernel size.
  • border: how to deal with the border.

Example

let a = ndarray::arr2(&[[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]);
let smoothed = simplecv::filter::mean_smooth(&a, 3,
                    simplecv::filter::BorderType::Constant(0.0));
let diff = simplecv::utils::max_diff(&smoothed, &(ndarray::Array::ones((3, 3)) / 9.0));
assert!(diff < 1e-4);