pub fn image_to_simple_histogram(image: &dyn Image, color: RGB) -> SimpleHistogram {
    let mut res: SimpleHistogram = SimpleHistogram::new();
    res.resize(image.width() as usize, 0);
    for y in 0..image.height() {
        for x in 0..image.width() {
            res[x as usize] += if image.pixel(x, y) == color { 1 } else { 0 };
        }
    }
    res
}
/// Function to match a single color in an image and convert this to a histogram.
Function to match a single color in an image and convert this to a histogram.
Function to match a single color in an image and convert this to a histogram .
pub fn image_to_simple_histogram(image: &dyn Image, color: RGB) -> SimpleHistogram {
    let mut res: SimpleHistogram = SimpleHistogram::new();
    res.resize(image.width() as usize, 0);
    for y in 0..image.height() {
        for x in 0..image.width() {
            res[x as usize] += if image.pixel(x, y) == color { 1 } else { 0 };
        }
    }
    res
}
pub fn image_to_simple_histogram ( image : & dyn Image , color : RGB ) -> SimpleHistogram { let mut res : SimpleHistogram = SimpleHistogram :: new ( ) ; res . resize ( image . width ( ) as usize , 0 ) ; for y in 0 .. image . height ( ) { for x in 0 .. image . width ( ) { res [ x as usize ] += if image . pixel ( x , y ) == color { 1 } else { 0 } ; } } res }
Function to match a single color in an image and convert this to a histogram.
Function to match a single color in an image and convert this to a histogram .
image
&dyn Image
color
RGB