Documentation of 'boofcv.alg.segmentation.slic.SegmentSlic' Java class
SegmentSlic
boofcv.alg.segmentation.slic

Class SegmentSlic<T extends ImageBase>

  • Direct Known Subclasses:
    SegmentSlic_F32, SegmentSlic_PlF32, SegmentSlic_PlU8, SegmentSlic_U8


    public abstract class SegmentSlic<T extends ImageBase>
    extends java.lang.Object

    K-means based superpixel image segmentation, see [1]. The image is broken up into superpixels (clusters of connected pixels) in a grid like pattern. A connectivity rule of 4 or 8 is enforced across all the clusters. Clustering is done using k-means, where each point is composed on the 2D image coordinate and an intensity value in each color band, thus K = 2+numBands. Instead of computing the distance of each cluster's center from each point only points within a distance of S si considered. The difference in scale difference between pixels and image intensity is handled through a user configurable tuning parameter.

    Deviations from paper:

    • In the paper a LAB color space is always used. In this implementation a general purpose N-dimensional color space is used.
    • To correctly support LAB or other color spaces a specialized implementation might be needed to ensure the intensity of a pixel is computed correctly.
    • Small regions are merged into other regions based on how similar their color is. In the paper a small region is merged into the largest region it is connected to.

    [1] Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk, SLIC Superpixels, EPFL Technical Report no. 149300, June 2010.

    • Constructor Detail

      • SegmentSlic

        public SegmentSlic(int numberOfRegions,
                           float m,
                           int totalIterations,
                           ConnectRule connectRule,
                           ImageType<T> imageType)
    • Method Detail

      • process

        public void process(T input,
                            GrayS32 output)
      • setColor

        public abstract void setColor(float[] color,
                                      int x,
                                      int y)
        Sets the cluster's to the pixel color at that location
      • addColor

        public abstract void addColor(float[] color,
                                      int index,
                                      float weight)
        Performs a weighted add to the cluster's color at the specified pixel in the image
      • colorDistance

        public abstract float colorDistance(float[] color,
                                            int index)
        Euclidean Squared distance away that the pixel is from the provided color
      • getIntensity

        public abstract float getIntensity(int x,
                                           int y)
        Intensity of the pixel at the specified location
      • assignLabelsToPixels

        public void assignLabelsToPixels(GrayS32 pixelToRegions,
                                         GrowQueue_I32 regionMemberCount,
                                         FastQueue<float[]> regionColor)
        Selects which region each pixel belongs to based on which cluster it is the closest to
      • getRegionMemberCount

        public GrowQueue_I32 getRegionMemberCount()
      • getImageType

        public ImageType<T> getImageType()

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.