public void process ( T image , GrayS32 pixelToRegion , GrowQueue_I32 regionMemberCount , FastQueue < float [ ] > regionColor ) { stopRequested = false ; // iterate until no more regions need to be merged together while ( ! stopRequested ) { // Update the color of each region regionColor . resize ( regionMemberCount . size ) ; computeColor . process ( image , pixelToRegion , regionMemberCount , regionColor ) ; initializeMerge ( regionMemberCount . size ) ; // Create a list of regions which are to be pruned if ( ! setupPruneList ( regionMemberCount ) ) break ; // Scan the image and create a list of regions which the pruned regions connect to findAdjacentRegions ( pixelToRegion ) ; // Select the closest match to merge into for ( int i = 0 ; i < pruneGraph . size ; i ++ ) { selectMerge ( i , regionColor ) ; } // Do the usual merge stuff performMerge ( pixelToRegion , regionMemberCount ) ; } }
Merges together smaller regions . Segmented image region member count and region color are all updated .