Class AbstractObjectLocator

    • Field Detail

      • m_CenterOnCanvas

        protected boolean m_CenterOnCanvas
        whether to place the located object on a fixed size canvas.
      • m_CanvasWidth

        protected int m_CanvasWidth
        the canvas width.
      • m_CanvasHeight

        protected int m_CanvasHeight
        the canvas height.
      • m_CanvasColor

        protected Color m_CanvasColor
        the canvas color.
      • m_Errors

        protected List<String> m_Errors
        for storing errors.
      • m_Warnings

        protected List<String> m_Warnings
        for storing warnings.
      • m_Stopped

        protected boolean m_Stopped
        whether the execution was stopped.
    • Constructor Detail

      • AbstractObjectLocator

        public AbstractObjectLocator()
    • Method Detail

      • getDefaultCenterOnCanvas

        protected boolean getDefaultCenterOnCanvas()
        Returns the default for centering the located object on a canvas.
        Returns:
        the default
      • setCenterOnCanvas

        public void setCenterOnCanvas​(boolean value)
        Sets whether to center the located object on a fixed-size canvas.
        Parameters:
        value - true if to center on fixed-size canvas
      • getCenterOnCanvas

        public boolean getCenterOnCanvas()
        Returns whether to center the located object on a fixed-size canvas.
        Returns:
        true if to center on fixed-size canvas
      • centerOnCanvasTipText

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

        protected int getDefaultCanvasWidth()
        Returns the default width of the canvas in pixels.
        Returns:
        the width in pixels
      • setCanvasWidth

        public void setCanvasWidth​(int value)
        Sets the width of the canvas in pixels.
        Parameters:
        value - the width in pixels
      • getCanvasWidth

        public int getCanvasWidth()
        Returns the width of the canvas in pixels.
        Returns:
        the width in pixels
      • canvasWidthTipText

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

        protected int getDefaultCanvasHeight()
        Returns the default height of the canvas in pixels.
        Returns:
        the height in pixels
      • setCanvasHeight

        public void setCanvasHeight​(int value)
        Sets the height of the canvas in pixels.
        Parameters:
        value - the height in pixels
      • getCanvasHeight

        public int getCanvasHeight()
        Returns the height of the canvas in pixels.
        Returns:
        the height in pixels
      • canvasHeightTipText

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

        protected Color getDefaultCanvasColor()
        Returns the default color for the canvas.
        Returns:
        the color
      • setCanvasColor

        public void setCanvasColor​(Color value)
        Sets the color to use for filling the canvas.
        Parameters:
        value - the color
      • getCanvasColor

        public Color getCanvasColor()
        Returns the color to use for filling the canvas.
        Returns:
        the color
      • canvasColorTipText

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

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.

        Default implementation returns null.
        Specified by:
        getQuickInfo in interface QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • hasErrors

        public boolean hasErrors()
        Checks whether there are any errors recorded.
        Returns:
        true if at least one error recorded
      • getErrors

        public List<String> getErrors()
        Returns the errors.
        Returns:
        the errors
      • addError

        protected void addError​(String msg)
        Adds the error to its internal list of errors.
        Parameters:
        msg - the error message to add
      • hasWarnings

        public boolean hasWarnings()
        Checks whether there are any warnings recorded;
        Returns:
        true if at least one error recorded
      • getWarnings

        public List<String> getWarnings()
        Returns the warnings.
        Returns:
        the warnings
      • addWarning

        protected void addWarning​(String msg)
        Adds the warning to its internal list of warnings.
        Parameters:
        msg - the warnings message to add
      • check

        protected void check​(BufferedImage image)
        Checks whether the input can be used.

        Default implementation only checks whether image is not null.
        Parameters:
        image - the image to check
      • centerOnCanvas

        protected BufferedImage centerOnCanvas​(BufferedImage img)
        Copies the object image onto the canvas with defined dimensions and color. In case the image is too large for the canvas, the
        Parameters:
        img - the located object
        Returns:
        the new image with the located image centered
      • doLocate

        protected abstract LocatedObjects doLocate​(BufferedImage image,
                                                   boolean annotateOnly)
        Performs the actual locating of the objects.
        Parameters:
        image - the image to process
        annotateOnly - whether to annotate only
        Returns:
        the containers of located objects
      • locate

        public LocatedObjects locate​(BufferedImage image)
        Locates the objects in the image.
        Parameters:
        image - the image to process
        Returns:
        the containers of located objects
      • annotate

        public LocatedObjects annotate​(BufferedImage image)
        Only annotates the objects in the image, does not output any sub-images.
        Parameters:
        image - the image to process
        Returns:
        the annotated objects
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler