Package adams.flow.source
Class OpenCVDeviceFrameGrabber
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.source.AbstractSource
-
- adams.flow.source.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 Summary
Fields Modifier and Type Field Description protected org.bytedeco.javacv.OpenCVFrameConverter.ToMatm_Converterfor converting the frames.protected longm_Delaythe delay between frames in microsecond.protected intm_Devicethe device ID.protected org.bytedeco.javacv.FrameGrabberm_FrameGrabberthe frame grabber in use.protected BaseClassnamem_FrameGrabberClassthe frame grabber class.-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description OpenCVDeviceFrameGrabber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseFrameGrabber()Closes the frame grabber.voiddefineOptions()Adds options to the internal list of options.StringdelayTipText()Returns the tip text for this property.StringdeviceTipText()Returns the tip text for this property.protected StringdoExecute()Executes the flow item.StringframeGrabberClassTipText()Returns the tip text for this property.Class[]generates()Returns the class of objects that it generates.longgetDelay()Returns the delay before grabbing a frame in microsecond.intgetDevice()Returns the device ID.BaseClassnamegetFrameGrabberClass()Returns the class of the frame grabber to utilize.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.booleanhasPendingOutput()Checks whether there is pending output to be collected after executing the flow item.Tokenoutput()Returns the generated token.voidsetDelay(long value)Sets the delay before grabbing a frame in microsecond.voidsetDevice(int value)Sets the device ID.voidsetFrameGrabberClass(BaseClassname value)Sets the class of the frame grabber to utilize.voidstopExecution()Stops the execution.voidwrapUp()Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, pruneBackup, reset, restoreState, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
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
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
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.
-
-
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()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
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
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classAbstractActor- 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.
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractActor
-
-