pub fn moving_windowed_histogram<'a>(
    image: &dyn Image,
    window_size: u32,
    matcher: &'a dyn Matcher,
    labels: &[ColorLabel],
) -> Vec<Match2D<'a>> {
    let mut res_final: Vec<Match2D<'a>> = Vec::new();

    // Container for results under consideration, we check matches against overlap in this window
    // and keep the parts that are the best matches.
    let mut res_consider: VecDeque<Match2D<'a>> = VecDeque::new();
    // Once the matches here move out of the window, we move them to res itself.

    // Create our histogram iterator.
    let iterable = WindowHistogramIterator::new(image, labels, window_size);
    for bin in iterable {
        let y = bin.y();
        let histogram = bin.histogram();

        // Find glyphs in the histogram.
        let matches = bin_glyph_matcher(&histogram, matcher);

        // Resolve the found matches and group the consecutive tokens into 2d matches.
        let matches_2d = match_resolver(y, window_size, &matches);

        // Decide which matches are to be kept.
        decide_on_matches(matches_2d, &mut res_consider);

        // Move matches from res_consider to res_final.
        finalize_considerations(y, &mut res_consider, &mut res_final);
    }
    res_final.extend(res_consider.drain(..));

    res_final
}
/// Function to slide a window over an image and match glyphs for each histogram thats created.
Function to slide a window over an image and match glyphs for each histogram thats created.
Function to slide a window over an image and match glyphs for each histogram thats created .
pub fn moving_windowed_histogram<'a>(
    image: &dyn Image,
    window_size: u32,
    matcher: &'a dyn Matcher,
    labels: &[ColorLabel],
) -> Vec<Match2D<'a>> {
    let mut res_final: Vec<Match2D<'a>> = Vec::new();
    // Container for results under consideration, we check matches against overlap in this window
    // and keep the parts that are the best matches.
    let mut res_consider: VecDeque<Match2D<'a>> = VecDeque::new();
    // Once the matches here move out of the window, we move them to res itself.
    // Create our histogram iterator.
    let iterable = WindowHistogramIterator::new(image, labels, window_size);
    for bin in iterable {
        let y = bin.y();
        let histogram = bin.histogram();
        // Find glyphs in the histogram.
        let matches = bin_glyph_matcher(&histogram, matcher);
        // Resolve the found matches and group the consecutive tokens into 2d matches.
        let matches_2d = match_resolver(y, window_size, &matches);
        // Decide which matches are to be kept.
        decide_on_matches(matches_2d, &mut res_consider);
        // Move matches from res_consider to res_final.
        finalize_considerations(y, &mut res_consider, &mut res_final);
    }
    res_final.extend(res_consider.drain(..));
    res_final
}
pub fn moving_windowed_histogram < ' a > ( image : & dyn Image , window_size : u32 , matcher : & ' a dyn Matcher , labels : & [ ColorLabel ] , ) -> Vec < Match2D < ' a > > { let mut res_final : Vec < Match2D < ' a > > = Vec :: new ( ) ; // Container for results under consideration, we check matches against overlap in this window // and keep the parts that are the best matches. let mut res_consider : VecDeque < Match2D < ' a > > = VecDeque :: new ( ) ; // Once the matches here move out of the window, we move them to res itself. // Create our histogram iterator. let iterable = WindowHistogramIterator :: new ( image , labels , window_size ) ; for bin in iterable { let y = bin . y ( ) ; let histogram = bin . histogram ( ) ; // Find glyphs in the histogram. let matches = bin_glyph_matcher ( & histogram , matcher ) ; // Resolve the found matches and group the consecutive tokens into 2d matches. let matches_2d = match_resolver ( y , window_size , & matches ) ; // Decide which matches are to be kept. decide_on_matches ( matches_2d , & mut res_consider ) ; // Move matches from res_consider to res_final. finalize_considerations ( y , & mut res_consider , & mut res_final ) ; } res_final . extend ( res_consider . drain ( .. ) ) ; res_final }
Function to slide a window over an image and match glyphs for each histogram thats created.
Function to slide a window over an image and match glyphs for each histogram thats created .
image
&dyn Image
window_size
u32
matcher
&'a dyn Matcher
labels
&[ColorLabel]