mod common; use ccvl::*; const OUTER: image::SRGBA = image::SRGBA { r: 0.0, g: 1.0, b: 0.0, a: 1.0, }; const INNER: image::SRGBA = image::SRGBA { r: 0.0, g: 0.0, b: 1.0, a: 1.0, }; fn main() -> std::process::ExitCode { common::process_image(|mut img| { let greyscale = img.map(|p| image::Luminance::from(p)); let thresholded = filter::threshold_auto(greyscale); let contours = contour::find(thresholded); for contour in contours { for (x, y) in contour.trace { *img.at_mut(x, y) = match contour.kind { contour::Kind::Inner => INNER, contour::Kind::Outer => OUTER, }; } } img }) }