ColourLocator

open class ColourLocator : Processor<T>

BunyipsLib vision pipeline wrapper for a ColorBlobLocatorProcessor.

The ColorBlobLocatorProcessor finds "blobs" of a user-specified color in the image. You can restrict the search area to a specified Region of Interest (ROI).

This processor is the SDK-provided alternative to the ColourThreshold processor. Compared to ColourThreshold, this processor is less advanced in terms of the data it provides, but does not require a new class to be extended for each new colour range.

Author

Lucas Bubner, 2024

Since

5.0.0

See also

Constructors

Link copied to clipboard
constructor(@NonNull regionOfInterest: ImageRegion, @NonNull targetRange: ColorRange, @NonNull generationMode: ColorBlobLocatorProcessor.ContourMode)
Construct a new ColourLocator with minimum settings.
constructor(@NonNull builder: (ColorBlobLocatorProcessor.Builder) -> ColorBlobLocatorProcessor.Builder)
Construct a new ColourLocator with extra and required settings supplied at your own discretion.

Properties

Link copied to clipboard
@get:NonNull
val instance: ColorBlobLocatorProcessor

Inherited 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 addFilter(@NonNull filter: ColorBlobLocatorProcessor.BlobFilter)
Add a filter.
Link copied to clipboard
open 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.
Link copied to clipboard
protected open fun onFrameDraw(@NonNull canvas: Canvas)
Called by the vision system to draw on the frame.
Link copied to clipboard
protected open fun onProcessFrame(@NonNull frame: Mat, captureTimeNanos: Long)
Called by the vision system to process a frame.
Link copied to clipboard
open fun removeAllFilters()
Remove all filters.
Link copied to clipboard
open fun removeFilter(@NonNull filter: ColorBlobLocatorProcessor.BlobFilter)
Remove a filter.
Link copied to clipboard
open fun resetForOpMode()
Reset instance count for processor identification.
Link copied to clipboard
open fun setSort(@NonNull sortingMethod: ColorBlobLocatorProcessor.BlobSort)
Sets the list sorting method to use in the data.
Link copied to clipboard
protected open fun update()
Called to update new data from the vision system, which involves interpreting, collecting, or otherwise processing new vision data per frame.

Inherited 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>>)
abstract fun getFrameBitmap(p: Continuation<out Consumer<Bitmap>>)
Link copied to clipboard
fun init(width: Int, height: Int, @Nullable calibration: CameraCalibration)
abstract fun init(p: Int, p1: Int, p2: 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.
abstract fun onDrawFrame(p: Canvas, p1: Int, p2: Int, p3: Float, p4: Float, p5: Any)
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
abstract fun processFrame(p: Mat, p1: Long): Any
Link copied to clipboard