Package adams.data.boofcv.transformer
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 Summary
Fields Modifier and Type Field Description static int
B
the index for blue.static int
G
the index for green.protected boolean
m_AverageSegments
whether to average the segments.protected int
m_NumSegments
the number of segments.protected boolean
m_OutlineSegments
whether to outline the segments.protected boolean
m_RandomColors
whether to use random colors.protected float
m_SpatialWeight
the spatial weight.static int
R
the index for red.-
Fields inherited from class adams.data.image.AbstractImageTransformer
m_FlowContext
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description SuperPixels()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.String
averageSegmentsTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected BoofCVImageContainer[]
doTransform(BoofCVImageContainer img)
Performs the actual transforming of the image.int
getNumSegments()
Returns the number of segments.float
getSpatialWeight()
Returns the spatial weight in use.String
globalInfo()
Returns a string describing the object.boolean
isAverageSegments()
Returns whether to average the segments.boolean
isOutlineSegments()
Returns whether to outline the segments.boolean
isRandomColors()
Returns whether to use random colors.String
numSegmentsTipText()
Returns the tip text for this property.String
outlineSegmentsTipText()
Returns the tip text for this property.String
randomColorsTipText()
Returns the tip text for this property.void
setAverageSegments(boolean value)
Sets whether to average the segments.void
setNumSegments(int value)
Sets the number of segments to use.void
setOutlineSegments(boolean value)
Sets whether to outline the segments.void
setRandomColors(boolean value)
Sets whether to use random colors.void
setSpatialWeight(float value)
Sets the spatial weight to use.String
spatialWeightTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.boofcv.transformer.AbstractBoofCVTransformer
forCommandLine, forName, getTransformations
-
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, getFlowContext, getQuickInfo, initialize, setFlowContext, shallowCopy, shallowCopy, transform
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
R
public static final int R
the index for red.- See Also:
- Constant Field Values
-
G
public static final int G
the index for green.- See Also:
- Constant Field Values
-
B
public static final int B
the index for blue.- See Also:
- Constant Field Values
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
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 regionsnumSegments
- the number of super pixelsimage
- The image to be transformed
-
doTransform
protected BoofCVImageContainer[] doTransform(BoofCVImageContainer img)
Performs the actual transforming of the image.- Specified by:
doTransform
in classAbstractImageTransformer<BoofCVImageContainer>
- Parameters:
img
- the image to transform (can be modified, since it is a copy)- Returns:
- the generated image(s)
-
-