Class SuperPixels

  • All Implemented Interfaces:
    CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, SizeOfHandler, ImageTransformer<BoofCVImageContainer>, FlowContextHandler, Serializable, Comparable

    public class SuperPixels
    extends AbstractBoofCVTransformer
    Takes an image and divides it into super pixels.

    For more information see:
    http://boofcv.org/index.php?title=Tutorial_Image_Segmentation

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -num-segments <int> (property: numSegments)
        The number of segments to use.
        default: 100
        minimum: 1
     
    -spatial-weight <float> (property: spatialWeight)
        The spatial weight.
        default: 200.0
        minimum: 0.0
     
    -outline-segments <boolean> (property: outlineSegments)
        If enabled, segments get outlined.
        default: false
     
    -average-segments <boolean> (property: averageSegments)
        If enabled, segments get averaged.
        default: false
     
    -random-colors <boolean> (property: randomColors)
        If enabled, random colors are used.
        default: false
     
    Author:
    sjb90
    See Also:
    Serialized Form
    • Field Detail

      • m_NumSegments

        protected int m_NumSegments
        the number of segments.
      • m_SpatialWeight

        protected float m_SpatialWeight
        the spatial weight.
      • m_AverageSegments

        protected boolean m_AverageSegments
        whether to average the segments.
      • m_OutlineSegments

        protected boolean m_OutlineSegments
        whether to outline the segments.
      • m_RandomColors

        protected boolean m_RandomColors
        whether to use random colors.
    • Constructor Detail

      • SuperPixels

        public SuperPixels()
    • Method Detail

      • setRandomColors

        public void setRandomColors​(boolean value)
        Sets whether to use random colors.
        Parameters:
        value - true if to use random colors
      • isRandomColors

        public boolean isRandomColors()
        Returns whether to use random colors.
        Returns:
        true if to use random colors
      • randomColorsTipText

        public String randomColorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumSegments

        public void setNumSegments​(int value)
        Sets the number of segments to use.
        Parameters:
        value - the number of segments
      • getNumSegments

        public int getNumSegments()
        Returns the number of segments.
        Returns:
        the number of segments
      • numSegmentsTipText

        public String numSegmentsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSpatialWeight

        public void setSpatialWeight​(float value)
        Sets the spatial weight to use.
        Parameters:
        value - the weight
      • getSpatialWeight

        public float getSpatialWeight()
        Returns the spatial weight in use.
        Returns:
        the weight
      • spatialWeightTipText

        public String spatialWeightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setAverageSegments

        public void setAverageSegments​(boolean value)
        Sets whether to average the segments.
        Parameters:
        value - true if to average
      • isAverageSegments

        public boolean isAverageSegments()
        Returns whether to average the segments.
        Returns:
        true if to average
      • averageSegmentsTipText

        public String averageSegmentsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOutlineSegments

        public void setOutlineSegments​(boolean value)
        Sets whether to outline the segments.
        Parameters:
        value - true if to outline
      • isOutlineSegments

        public boolean isOutlineSegments()
        Returns whether to outline the segments.
        Returns:
        true if to outline
      • outlineSegmentsTipText

        public String outlineSegmentsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • averageSegmentColour

        protected void averageSegmentColour​(boofcv.struct.image.GrayS32 pixelMap,
                                            int numSegments,
                                            BufferedImage image)
        Takes a super pixel map and an image and averages the colours in every super pixel region defined by the map.
        Parameters:
        pixelMap - The map of the super pixel regions
        numSegments - the number of super pixels
        image - The image to be transformed