Package frclib.vision
Class FrcOpenCvAprilTagPipeline
java.lang.Object
frclib.vision.FrcOpenCvAprilTagPipeline
- All Implemented Interfaces:
TrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
public class FrcOpenCvAprilTagPipeline
extends Object
implements TrcOpenCvPipeline<TrcOpenCvDetector.DetectedObject<?>>
This class implements an AprilTag pipeline using OpenCV.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class encapsulates info of the detected object. -
Constructor Summary
ConstructorsConstructorDescriptionFrcOpenCvAprilTagPipeline
(String tagFamily, edu.wpi.first.apriltag.AprilTagDetector.Config detectorConfig, edu.wpi.first.apriltag.AprilTagPoseEstimator.Config poseEstConfig) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionThis 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.void
This method prints the performance metrics to the trace log.process
(org.opencv.core.Mat input) This method is called to process the input image through the pipeline.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
This method cycles to the next intermediate mat of the pipeline as the video output mat.void
setPerformanceMetricsEnabled
(boolean enabled) This method enables/disables performance metrics.void
setVideoOutput
(int intermediateStep) This method sets the intermediate mat of the pipeline as the video output mat.toString()
This method returns the tag family string.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
-
Constructor Details
-
FrcOpenCvAprilTagPipeline
public FrcOpenCvAprilTagPipeline(String tagFamily, edu.wpi.first.apriltag.AprilTagDetector.Config detectorConfig, edu.wpi.first.apriltag.AprilTagPoseEstimator.Config poseEstConfig) Constructor: Create an instance of the object.- Parameters:
tagFamily
- specifies the tag family.detectorConfig
- specifies the detector configuration.poseEstConfig
- specifies the pose estimator configuration (tagSize unit is in meter).
-
-
Method Details
-
toString
This method returns the tag family string. -
setPerformanceMetricsEnabled
public void setPerformanceMetricsEnabled(boolean enabled) This method enables/disables performance metrics.- Parameters:
enabled
- specifies true to enable performance metrics, false to disable.
-
printPerformanceMetrics
public void printPerformanceMetrics()This method prints the performance metrics to the trace log. -
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 (1 is the original mat, 0 to disable video output if supported).
-
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 (step 1 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.
-