Processor

abstract class Processor<T : VisionData?> : VisionProcessor, CameraStreamSource

Base class for all vision processors using the Vision system.

A processor will be attached to a Vision instance and will be called to process frames, allowing you to access your data here using the .getData() method. This makes it useful for tasks to access the latest data from the vision system, without needing to directly interface with the Vision instance.

Author

Lucas Bubner, 2023

Since

1.0.0-pre

Parameters

<T>

the type of VisionData to be processed

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
protected val data: List<T>
List of all vision data detected since the last stateful update.
Link copied to clipboard
open var isFlipped: Boolean
Link copied to clipboard
open val isRunning: Boolean

Functions

Link copied to clipboard
open fun clearData()
Manually clear the data list.
Link copied to clipboard
open fun delegate(@NonNull delegateTo: Processor)
Delegate this processor to another processor.
Link copied to clipboard
open fun getData(): ArrayList<T>
Get the list of vision data.
Link copied to clipboard
open fun getFrameBitmap(@NonNull continuation: Continuation<out Consumer<Bitmap>>)
Link copied to clipboard
abstract fun getId(): String
Unique identifier for the processor.
Link copied to clipboard
open fun init(@Nullable calibration: CameraCalibration)
Optional method to implement to access the camera calibration data.
fun init(width: Int, height: Int, @Nullable calibration: CameraCalibration)
Link copied to clipboard
open fun isAttached(): Boolean
Determine whether the processor is attached to a Vision instance or is initialised.
Link copied to clipboard
protected open fun onAttach()
Override this method to run any additional code that will be executed when this processor is attached (via init()) by a Vision instance.
Link copied to clipboard
fun onDrawFrame(@NonNull canvas: Canvas, onscreenWidth: Int, onscreenHeight: Int, scaleBmpPxToCanvasPx: Float, scaleCanvasDensity: Float, @NonNull userContext: Any)
Use onFrameDraw instead, which passes a canvas.
Link copied to clipboard
protected abstract fun onFrameDraw(@NonNull canvas: Canvas)
Called by the vision system to draw on the frame.
Link copied to clipboard
protected abstract fun onProcessFrame(@NonNull frame: Mat, captureTimeNanos: Long)
Called by the vision system to process a frame.
Link copied to clipboard
protected open fun onRunning()
Override this method to run any additional code that will be executed when this processor starts streaming (via start()) on a Vision instance.
Link copied to clipboard
fun processFrame(@NonNull frame: Mat, captureTimeNanos: Long): Any
Link copied to clipboard
Link copied to clipboard
protected abstract fun update()
Called to update new data from the vision system, which involves interpreting, collecting, or otherwise processing new vision data per frame.