1+ //! Processor to remove small clusters by merging into larger ones
12use std:: collections:: HashSet ;
23use visioncortex:: { Color , ColorImage } ;
34use visioncortex:: color_clusters:: Clusters ;
@@ -14,12 +15,16 @@ pub struct Processor {
1415 counter : usize ,
1516}
1617
18+ /// [`Clusters`]
1719pub type Input = Clusters ;
1820
21+ /// [`ColorImage`]
1922pub type Output = ColorImage ;
2023
2124pub struct Params {
25+ /// Allowed color difference between shapes in same aggregate
2226 pub deviation : f64 ,
27+ /// Minimum patch size in area
2328 pub min_size : u32 ,
2429}
2530
@@ -29,9 +34,9 @@ struct Aggregate {
2934}
3035
3136#[ derive( Copy , Clone , Default , Eq , Ord , Hash , PartialEq , PartialOrd ) ]
32- pub struct AggregateIndex ( pub usize ) ;
37+ struct AggregateIndex ( pub usize ) ;
3338
34- pub const ZERO : AggregateIndex = AggregateIndex ( 0 ) ;
39+ const ZERO : AggregateIndex = AggregateIndex ( 0 ) ;
3540
3641impl Default for Params {
3742 fn default ( ) -> Self {
@@ -149,7 +154,7 @@ impl Processor {
149154 & mut self . aggregates [ index. 0 as usize ]
150155 }
151156
152- pub fn neighbours_of ( & self , myselfi : AggregateIndex ) -> Vec < AggregateIndex > {
157+ fn neighbours_of ( & self , myselfi : AggregateIndex ) -> Vec < AggregateIndex > {
153158 let myself = self . get_agg ( myselfi) ;
154159 let mut neighbours = HashSet :: new ( ) ;
155160
0 commit comments