Class OpenCVDeviceFrameGrabber

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, OutputProducer, Serializable, Comparable

    public class OpenCVDeviceFrameGrabber
    extends AbstractSource
    Grabs frames from the specified device and forwards them as image containers.

    Input/output:
    - generates:
       adams.data.opencv.OpenCVImageContainer


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: OpenCVDeviceFrameGrabber
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -frame-grabber-class <adams.core.base.BaseClassname> (property: frameGrabberClass)
        The frame grabber class to utilize for obtaining the frames.
        default: org.bytedeco.javacv.OpenCVFrameGrabber
     
    -device <int> (property: device)
        The ID of the device to grab frames from.
        default: 0
     
    -delay <long> (property: delay)
        The delay in microsecond before grabbing a frame.
        default: 0
        minimum: 0
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_FrameGrabberClass

        protected BaseClassname m_FrameGrabberClass
        the frame grabber class.
      • m_Device

        protected int m_Device
        the device ID.
      • m_Delay

        protected long m_Delay
        the delay between frames in microsecond.
      • m_FrameGrabber

        protected transient org.bytedeco.javacv.FrameGrabber m_FrameGrabber
        the frame grabber in use.
      • m_Converter

        protected transient org.bytedeco.javacv.OpenCVFrameConverter.ToMat m_Converter
        for converting the frames.
    • Constructor Detail

      • OpenCVDeviceFrameGrabber

        public OpenCVDeviceFrameGrabber()
    • Method Detail

      • setFrameGrabberClass

        public void setFrameGrabberClass​(BaseClassname value)
        Sets the class of the frame grabber to utilize.
        Parameters:
        value - the class
      • getFrameGrabberClass

        public BaseClassname getFrameGrabberClass()
        Returns the class of the frame grabber to utilize.
        Returns:
        the class
      • frameGrabberClassTipText

        public String frameGrabberClassTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setDevice

        public void setDevice​(int value)
        Sets the device ID.
        Parameters:
        value - the ID
      • getDevice

        public int getDevice()
        Returns the device ID.
        Returns:
        the ID
      • deviceTipText

        public String deviceTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setDelay

        public void setDelay​(long value)
        Sets the delay before grabbing a frame in microsecond.
        Parameters:
        value - the delay
      • getDelay

        public long getDelay()
        Returns the delay before grabbing a frame in microsecond.
        Returns:
        the delay
      • delayTipText

        public String delayTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Returns:
        the Class of the generated tokens
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
      • output

        public Token output()
        Returns the generated token.
        Returns:
        the generated token
      • hasPendingOutput

        public boolean hasPendingOutput()
        Checks whether there is pending output to be collected after executing the flow item.

        The method is not allowed allowed to return "true" before the actor has been executed. For actors that return an infinite number of tokens, the m_Executed flag can be returned.
        Returns:
        true if there is pending output
      • closeFrameGrabber

        protected void closeFrameGrabber()
        Closes the frame grabber.
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished. Graphical output is left untouched.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class AbstractActor