Package trclib.vision
Class TrcVisionTask<I,O>
java.lang.Object
trclib.vision.TrcVisionTask<I,O>
- Type Parameters:
I
- specifies the type of the input image.O
- specifies the type of the detected objects.
This class implements a platform independent vision task. When enabled, it grabs a frame from the video source,
calls the provided vision processor to process the frame and overlays rectangles on the detected objects in the
image. This class is to be extended by a platform dependent vision processor.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTrcVisionTask
(String instanceName, TrcVisionProcessor<I, O> visionProcessor, I[] imageBuffers) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionO[]
This method returns the last detected objects.long
This method returns the vision task processing interval.boolean
This method returns the state of the vision task.void
setProcessingInterval
(long interval) This method sets the vision task processing interval.void
setTaskEnabled
(boolean enabled) This method enables/disables the vision task.toString()
This method returns the instance name.
-
Field Details
-
tracer
-
-
Constructor Details
-
TrcVisionTask
public TrcVisionTask(String instanceName, TrcVisionProcessor<I, O> visionProcessor, I[] imageBuffers) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.visionProcessor
- specifies the vision processor object.imageBuffers
- specifies an array of image buffers.
-
-
Method Details
-
toString
This method returns the instance name. -
setTaskEnabled
public void setTaskEnabled(boolean enabled) This method enables/disables the vision task. As long as the task is enabled, it will continue to acquire/process images.- Parameters:
enabled
- specifies true to enable vision task, false to disable.
-
isTaskEnabled
public boolean isTaskEnabled()This method returns the state of the vision task.- Returns:
- true if the vision task is enabled, false otherwise.
-
setProcessingInterval
public void setProcessingInterval(long interval) This method sets the vision task processing interval.- Parameters:
interval
- specifies the processing interval in msec. If 0, process as fast as the CPU can run.
-
getProcessingInterval
public long getProcessingInterval()This method returns the vision task processing interval.- Returns:
- vision task processing interval in msec.
-
getDetectedObjects
This method returns the last detected objects. Note that this call consumes the objects, meaning if this method is called again before the next frame is finished processing, it will return a null.- Returns:
- the last detected objects.
-