Package ftclib.vision
Class FtcRawEocvColorBlobPipeline
java.lang.Object
org.openftc.easyopencv.OpenCvPipeline
ftclib.vision.FtcRawEocvColorBlobPipeline
- All Implemented Interfaces:
TrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
public class FtcRawEocvColorBlobPipeline
extends org.openftc.easyopencv.OpenCvPipeline
implements TrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
This class implements an EOCV color blob pipeline.
-
Field Summary
FieldsFields inherited from class org.openftc.easyopencv.OpenCvPipeline
MEMLEAK_DETECTION_ENABLED, MEMLEAK_DETECTION_PIPELINE_SETTLE_DELAY_SECONDS, MEMLEAK_THRESHOLD_MB
-
Constructor Summary
ConstructorsConstructorDescriptionFtcRawEocvColorBlobPipeline
(String instanceName, Integer colorConversion, double[] colorThresholds, TrcOpenCvColorBlobPipeline.FilterContourParams filterContourParams, boolean externalContourOnly) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
This method returns the color threshold values.This method returns the array of detected objects.org.opencv.core.Mat
getIntermediateOutput
(int step) This method returns an intermediate processed frame.org.opencv.core.Mat
This method returns the selected intermediate output Mat.boolean
This method checks if image annotation is enabled.process
(org.opencv.core.Mat input) This method is called to process the input image through the pipeline.org.opencv.core.Mat
processFrame
(org.opencv.core.Mat input) This method is called by OpenCvPipeline to process an image frame.void
reset()
This method is called to reset the state of the pipeline if any.void
setAnnotateEnabled
(boolean enabled) This method enables/disables image annotation of the detected object.void
setColorThresholds
(double... colorThresholds) This method sets the color threshold values.void
This method cycles to the next intermediate mat of the pipeline as the video output mat.void
setVideoOutput
(int intermediateStep) This method sets the intermediate mat of the pipeline as the video output mat.toString()
This method returns the pipeline instance name.Methods inherited from class org.openftc.easyopencv.OpenCvPipeline
getUserContextForDrawHook, init, onDrawFrame, onViewportTapped, requestViewportDrawHook, saveMatToDisk, saveMatToDiskFullPath
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface trclib.vision.TrcOpenCvPipeline
annotateFrame
-
Field Details
-
colorBlobPipeline
-
tracer
-
-
Constructor Details
-
FtcRawEocvColorBlobPipeline
public FtcRawEocvColorBlobPipeline(String instanceName, Integer colorConversion, double[] colorThresholds, TrcOpenCvColorBlobPipeline.FilterContourParams filterContourParams, boolean externalContourOnly) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.colorConversion
- specifies color space conversion, can be null if no color space conversion. Note: FTC ECOV input Mat format is RGBA, so you need to do Imgproc.COLOR_RGBA2xxx or Imgproc.COLOR_RGB2xxx conversion.colorThresholds
- specifies an array of color thresholds. If useHsv is false, the array contains RGB thresholds (minRed, maxRed, minGreen, maxGreen, minBlue, maxBlue). If useHsv is true, the array contains HSV thresholds (minHue, maxHue, minSat, maxSat, minValue, maxValue).filterContourParams
- specifies the parameters for filtering contours, can be null if not provided.externalContourOnly
- specifies true for finding external contours only, false otherwise (not applicable if filterContourParams is null).
-
-
Method Details
-
toString
This method returns the pipeline instance name. -
getColorThresholds
public double[] getColorThresholds()This method returns the color threshold values.- Returns:
- array of color threshold values.
-
setColorThresholds
public void setColorThresholds(double... colorThresholds) This method sets the color threshold values.- Parameters:
colorThresholds
- specifies an array of color threshold values.
-
reset
public void reset()This method is called to reset the state of the pipeline if any.- Specified by:
reset
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
-
process
This method is called to process the input image through the pipeline.- Specified by:
process
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Parameters:
input
- specifies the input image to be processed.- Returns:
- array of detected objects.
-
getDetectedObjects
This method returns the array of detected objects.- Specified by:
getDetectedObjects
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Returns:
- array of detected objects.
-
setAnnotateEnabled
public void setAnnotateEnabled(boolean enabled) This method enables/disables image annotation of the detected object.- Specified by:
setAnnotateEnabled
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Parameters:
enabled
- specifies true to enable annotation, false to disable.
-
isAnnotateEnabled
public boolean isAnnotateEnabled()This method checks if image annotation is enabled.- Specified by:
isAnnotateEnabled
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Returns:
- true if annotation is enabled, false otherwise.
-
setVideoOutput
public void setVideoOutput(int intermediateStep) This method sets the intermediate mat of the pipeline as the video output mat.- Specified by:
setVideoOutput
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Parameters:
intermediateStep
- specifies the intermediate mat used as video output (0 is the original input frame).
-
setNextVideoOutput
public void setNextVideoOutput()This method cycles to the next intermediate mat of the pipeline as the video output mat.- Specified by:
setNextVideoOutput
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
-
getIntermediateOutput
public org.opencv.core.Mat getIntermediateOutput(int step) This method returns an intermediate processed frame. Typically, a pipeline processes a frame in a number of steps. It may be useful to see an intermediate frame for a step in the pipeline for tuning or debugging purposes.- Specified by:
getIntermediateOutput
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Parameters:
step
- specifies the intermediate step (0 is the original input frame).- Returns:
- processed frame of the specified step.
-
getSelectedOutput
public org.opencv.core.Mat getSelectedOutput()This method returns the selected intermediate output Mat.- Specified by:
getSelectedOutput
in interfaceTrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
- Returns:
- selected output mat.
-
processFrame
public org.opencv.core.Mat processFrame(org.opencv.core.Mat input) This method is called by OpenCvPipeline to process an image frame.- Specified by:
processFrame
in classorg.openftc.easyopencv.OpenCvPipeline
- Parameters:
input
- specifies the image frame to be processed.- Returns:
- the image frame to be displayed.
-