public class SegmentMeanShift<T extends boofcv.struct.image.ImageBase>
extends java.lang.Object
Performs 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 and Description |
|---|
SegmentMeanShift(SegmentMeanShiftSearch<T> search,
MergeRegionMeanShift merge,
MergeSmallRegions<T> prune,
boofcv.struct.ConnectRule connectRule)
Specifies internal classes used by mean-shift.
|
| Modifier and Type | Method and Description |
|---|---|
boofcv.struct.image.ImageType<T> |
getImageType() |
int |
getNumberOfRegions()
The number of regions which it found in the image.
|
org.ddogleg.struct.FastQueue<float[]> |
getRegionColor()
Average color of each region
|
org.ddogleg.struct.GrowQueue_I32 |
getRegionSize()
Number of pixels in each region
|
void |
process(T image,
boofcv.struct.image.GrayS32 output)
Performs mean-shift segmentation on the input image.
|
public SegmentMeanShift(SegmentMeanShiftSearch<T> search, MergeRegionMeanShift merge, MergeSmallRegions<T> prune, boofcv.struct.ConnectRule connectRule)
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 4public void process(T image, boofcv.struct.image.GrayS32 output)
getNumberOfRegions().image - Imageoutput - Storage for output image. Each pixel is set to the region it belongs to.public int getNumberOfRegions()
public org.ddogleg.struct.FastQueue<float[]> getRegionColor()
public org.ddogleg.struct.GrowQueue_I32 getRegionSize()
public boofcv.struct.image.ImageType<T> getImageType()