pub fn threshold(image: &GrayImage, thresh: u8) -> GrayImage
Expand description
Returns a binarized image from an input 8bpp grayscale image obtained by applying the given threshold. Pixels with intensity equal to the threshold are assigned to the background.
ยงExamples
use imageproc::contrast::threshold;
let image = gray_image!(
10, 80, 20;
50, 90, 70);
let thresholded = gray_image!(
0, 255, 0;
0, 255, 255);
assert_pixels_eq!(threshold(&image, 50), thresholded);