Class 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 Detail

      • m_MinSize

        protected int m_MinSize
        Minimum object size.
      • m_MaxSize

        protected int m_MaxSize
        Maximum object size.
      • m_Scale

        protected double m_Scale
        Scale factor of working image (decrease scale for speed, increase for accuracy).
      • 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.
    • Constructor Detail

      • XScreenMaskLocator

        public XScreenMaskLocator()
    • Method Detail

      • 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
      • 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:
        doLocate in class AbstractObjectLocator
        Parameters:
        image - the image to process
        annotateOnly - 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 mask
        xStart - start x coordinate
        yStart - start y coordinate
        Returns:
        bounding box