Class XScreenMaskLocator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.locateobjects.AbstractObjectLocator
-
- adams.flow.transformer.locateobjects.XScreenMaskLocator
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Stoppable,Serializable
public class XScreenMaskLocator extends AbstractObjectLocator
Using the XScreenMask, this locator masks out the background plate (similar to a green screening process)then proceeds to find blobs in the resultant image.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-center-on-canvas <boolean> (property: centerOnCanvas) If enabled, the located objects get centered on a canvas of fixed size. default: false
-canvas-width <int> (property: canvasWidth) The width of the canvas in pixels. default: 100 minimum: 1
-canvas-height <int> (property: canvasHeight) The height of the canvas in pixels. default: 100 minimum: 1
-canvas-color <java.awt.Color> (property: canvasColor) The color to use for filling the canvas. default: #ffffff
-min-size <int> (property: minSize) Minimum object size. default: 10 minimum: 0
-max-size <int> (property: maxSize) Maximum object size. default: 200 minimum: 0
-crop <adams.data.image.transformer.crop.AbstractCropAlgorithm> (property: crop) Cropping algorithm. default: adams.data.image.transformer.crop.NoCrop
-scale <double> (property: scale) Scale factor of working image (decrease scale for speed, increase for accuracy ). default: 0.2 minimum: 0.1 maximum: 1.0
-color <RED|GREEN|BLUE|YELLOW> (property: color) Color to be masked out. default: RED
-down <boolean> (property: down) If true, then pixels <= threshold are not masked and the others' alpha channel are set to 0 (made transparent). default: true
-threshold <int> (property: threshold) Threshold value used for binarization, specify -1 to automatically determine a threshold. default: -1 minimum: -1 maximum: 255
- Version:
- $Revision$
- Author:
- lx51 (lx51 at students dot waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected XScreenMaskHelper.Colorm_ColorColor to be masked out.protected AbstractCropAlgorithmm_CropCropping algorithm.protected booleanm_DownIf true, then pixels <= threshold are not masked and the others' alpha channel are set to 0 (made transparent).protected intm_MaxSizeMaximum object size.protected intm_MinSizeMinimum object size.protected doublem_ScaleScale factor of working image (decrease scale for speed, increase for accuracy).protected intm_ThresholdThreshold value used for binarization, specify -1 to automatically determine a threshold.-
Fields inherited from class adams.flow.transformer.locateobjects.AbstractObjectLocator
m_CanvasColor, m_CanvasHeight, m_CanvasWidth, m_CenterOnCanvas, m_Errors, m_Stopped, m_Warnings
-
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 XScreenMaskLocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int[]boundingBox(int[][] mask, int xStart, int yStart)Find the bounding box in a binary mask using a flood-fill algorithm.StringcolorTipText()Returns the tip text for this property.StringcropTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected LocatedObjectsdoLocate(BufferedImage image, boolean annotateOnly)Returns the input image as output.StringdownTipText()Returns the tip text for this property.XScreenMaskHelper.ColorgetColor()Gets color to be masked out.AbstractCropAlgorithmgetCrop()Get cropping algorithm.booleangetDown()Get whether mask is applied below or above the threshold.intgetMaxSize()Get maximum object size.intgetMinSize()Get minimum object size.doublegetScale()Get scale factor of working image.intgetThreshold()Get the manual threshold value.StringglobalInfo()Returns a string describing the object.StringmaxSizeTipText()Returns the tip text for this property.StringminSizeTipText()Returns the tip text for this property.StringscaleTipText()Returns the tip text for this property.voidsetColor(XScreenMaskHelper.Color value)Sets color to be masked out.voidsetCrop(AbstractCropAlgorithm value)Set cropping algorithm.voidsetDown(boolean value)Set whether mask is applied below or above the threshold.voidsetMaxSize(int value)Set maximum object size.voidsetMinSize(int value)Set minimum object size.voidsetScale(double value)Set scale factor of working image.voidsetThreshold(int value)Set the manual threshold value.StringthresholdTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.locateobjects.AbstractObjectLocator
addError, addWarning, annotate, canvasColorTipText, canvasHeightTipText, canvasWidthTipText, centerOnCanvas, centerOnCanvasTipText, check, cleanUp, destroy, getCanvasColor, getCanvasHeight, getCanvasWidth, getCenterOnCanvas, getDefaultCanvasColor, getDefaultCanvasHeight, getDefaultCanvasWidth, getDefaultCenterOnCanvas, getErrors, getQuickInfo, getWarnings, hasErrors, hasWarnings, initialize, locate, reset, setCanvasColor, setCanvasHeight, setCanvasWidth, setCenterOnCanvas, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_MinSize
protected int m_MinSize
Minimum object size.
-
m_MaxSize
protected int m_MaxSize
Maximum object size.
-
m_Crop
protected AbstractCropAlgorithm m_Crop
Cropping algorithm.
-
m_Scale
protected double m_Scale
Scale factor of working image (decrease scale for speed, increase for accuracy).
-
m_Color
protected XScreenMaskHelper.Color m_Color
Color to be masked out.
-
m_Down
protected boolean m_Down
If true, then pixels <= threshold are not masked and the others' alpha channel are set to 0 (made transparent).
-
m_Threshold
protected int m_Threshold
Threshold value used for binarization, specify -1 to automatically determine a threshold.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Description copied from class:AbstractObjectLocatorAdds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractObjectLocator
-
getMinSize
public int getMinSize()
Get minimum object size.- Returns:
- minimum object size.
-
setMinSize
public void setMinSize(int value)
Set minimum object size.- Parameters:
value- minimum object size.
-
minSizeTipText
public String minSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getMaxSize
public int getMaxSize()
Get maximum object size.- Returns:
- maximum object size
-
setMaxSize
public void setMaxSize(int value)
Set maximum object size.- Parameters:
value- maximum object size
-
maxSizeTipText
public String maxSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getCrop
public AbstractCropAlgorithm getCrop()
Get cropping algorithm.- Returns:
- cropping algorithm.
-
setCrop
public void setCrop(AbstractCropAlgorithm value)
Set cropping algorithm.- Parameters:
value- cropping algorithm
-
cropTipText
public String cropTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getScale
public double getScale()
Get scale factor of working image.- Returns:
- scale factor
-
setScale
public void setScale(double value)
Set scale factor of working image.- Parameters:
value- scale factor
-
scaleTipText
public String scaleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getColor
public XScreenMaskHelper.Color getColor()
Gets color to be masked out.- Returns:
- color to be masked out
-
setColor
public void setColor(XScreenMaskHelper.Color value)
Sets color to be masked out.- Parameters:
value- bias
-
colorTipText
public String colorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getDown
public boolean getDown()
Get whether mask is applied below or above the threshold.- Returns:
- threshold direction
-
setDown
public void setDown(boolean value)
Set whether mask is applied below or above the threshold.- Parameters:
value- threshold direction
-
downTipText
public String downTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
getThreshold
public int getThreshold()
Get the manual threshold value.- Returns:
- manual threshold value
-
setThreshold
public void setThreshold(int value)
Set the manual threshold value.- Parameters:
value- manual threshold value
-
thresholdTipText
public String thresholdTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options
-
doLocate
protected LocatedObjects doLocate(BufferedImage image, boolean annotateOnly)
Returns the input image as output.- Specified by:
doLocatein classAbstractObjectLocator- Parameters:
image- the image to processannotateOnly- whether to annotate only- Returns:
- the containers of located objects
-
boundingBox
protected int[] boundingBox(int[][] mask, int xStart, int yStart)Find the bounding box in a binary mask using a flood-fill algorithm. Returns an int[]{top left X, top left Y, bottom right X, bottom right Y}, inclusive.- Parameters:
mask- generated maskxStart- start x coordinateyStart- start y coordinate- Returns:
- bounding box
-
-