Class MergeRegionMeanShift

java.lang.Object
boofcv.alg.segmentation.ms.RegionMergeTree
boofcv.alg.segmentation.ms.MergeRegionMeanShift
All Implemented Interfaces:
Stoppable

public class MergeRegionMeanShift
extends RegionMergeTree
Merges together regions which have modes close to each other and have a similar color.
  • Constructor Details

    • MergeRegionMeanShift

      public MergeRegionMeanShift​(int maxSpacialDistance, float maxColorDistance)
      Configures MergeRegionMeanShift
      Parameters:
      maxSpacialDistance - The maximum spacial distance (pixels) at which two modes can be for their regions to be merged together.
      maxColorDistance - The maximum Euclidean distance two colors can be from each other for them to be merged.
  • Method Details

    • process

      public void process​(GrayS32 pixelToRegion, DogArray_I32 regionMemberCount, DogArray<float[]> regionColor, DogArray<Point2D_I32> modeLocation)
      Merges together similar regions which are in close proximity to each other. After merging most of the input data structures are modified to take in account the changes.
      Parameters:
      pixelToRegion - (Input/output) Image that specifies the segmentation. Modified.
      regionMemberCount - (Input/output) Number of pixels in each region. Modified.
      regionColor - (Input/output) Color of each region. Modified.
      modeLocation - (Input) Location of each region's mode. Not modified.
    • markMergeRegions

      protected void markMergeRegions​(DogArray<float[]> regionColor, DogArray<Point2D_I32> modeLocation, GrayS32 pixelToRegion)
      Takes the mode of a region and searches the local area around it for other regions. If the region's mode is also within the local area its color is checked to see if it's similar enough. If the color is similar enough then the two regions are marked for merger.