Class SegmentMeanShift<T extends ImageBase>
- java.lang.Object
-
- boofcv.alg.segmentation.ms.SegmentMeanShift<T>
-
public class SegmentMeanShift<T extends ImageBase> extends java.lang.ObjectPerforms mean-shift segmentation on an image. Primary based upon the description provided in [1], it first uses mean-shift to find the mode of each pixel in the image. The mode is the location mean-shift converges to when initialized at a particular pixel. All the pixels which have the same mode, to within tolerance, are combined into one region. Since mean-shift does not guarantee that pixels which have the same label are connected to each other the labeled image is now segmented to ensure connectivity between labels. If a minimum size is specified for a segment then small regions are pruned and their pixels combined into the adjacent region which has the most similar color.
Mean-shift segmentation can be slow but it has the advantage of there being relatively few tuning parameters. Few tuning parameters make it easier to work with and to some extent more robust.
NOTE: Connectivity rule of 4 tends to produce more tightly compact regions while 8 produces fewer regions but with a more complex surface.
[1] Comaniciu, Dorin, and Peter Meer. "Mean shift analysis and applications." Computer Vision, 1999. The Proceedings of the Seventh IEEE International Conference on. Vol. 2. IEEE, 1999.
-
-
Constructor Summary
Constructors Constructor and Description SegmentMeanShift(SegmentMeanShiftSearch<T> search, MergeRegionMeanShift merge, MergeSmallRegions<T> prune, ConnectRule connectRule)Specifies internal classes used by mean-shift.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ImageType<T>getImageType()intgetNumberOfRegions()The number of regions which it found in the image.FastQueue<float[]>getRegionColor()Average color of each regionGrowQueue_I32getRegionSize()Number of pixels in each regionvoidprocess(T image, GrayS32 output)Performs mean-shift segmentation on the input image.
-
-
-
Constructor Detail
-
SegmentMeanShift
public SegmentMeanShift(SegmentMeanShiftSearch<T> search, MergeRegionMeanShift merge, MergeSmallRegions<T> prune, ConnectRule connectRule)
Specifies internal classes used by mean-shift.- Parameters:
search- mean-shift searchmerge- Used to merge regionsprune- Prunes small regions and merges them If null then prune step will be skipped.connectRule- Specify if a 4 or 8 connect rule should be used when segmenting disconnected regions. Try 4
-
-
Method Detail
-
process
public void process(T image, GrayS32 output)
Performs mean-shift segmentation on the input image. The total number of regions can be found by callinggetNumberOfRegions().- Parameters:
image- Imageoutput- Storage for output image. Each pixel is set to the region it belongs to.
-
getNumberOfRegions
public int getNumberOfRegions()
The number of regions which it found in the image.- Returns:
- Total regions
-
getRegionColor
public FastQueue<float[]> getRegionColor()
Average color of each region
-
getRegionSize
public GrowQueue_I32 getRegionSize()
Number of pixels in each region
-
-
DataMelt 3.0 © DataMelt by jWork.ORG