Package frclib.vision
Class FrcOpenCvDetector
java.lang.Object
trclib.vision.TrcOpenCvDetector
frclib.vision.FrcOpenCvDetector
- All Implemented Interfaces:
TrcVideoSource<org.opencv.core.Mat>
,TrcVisionProcessor<org.opencv.core.Mat,
TrcOpenCvDetector.DetectedObject<?>>
This class implements a platform dependent OpenCV detector. It implements the TrcVisionProcessor interface which
provides methods to use platform specific OpenCV to grab a frame, and output annotated frame to the output video
stream.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.vision.TrcOpenCvDetector
TrcOpenCvDetector.DetectedObject<O>, TrcOpenCvDetector.FilterTarget
-
Field Summary
Fields inherited from class trclib.vision.TrcOpenCvDetector
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionFrcOpenCvDetector
(String instanceName, int numImageBuffers, TrcHomographyMapper.Rectangle cameraRect, TrcHomographyMapper.Rectangle worldRect, edu.wpi.first.cscore.CvSink cvSink, edu.wpi.first.cscore.CvSource cvSource) Constructor: Create an instance of the object. -
Method Summary
Methods inherited from class trclib.vision.TrcOpenCvDetector
getDetectedTargetsInfo, getPipeline, getProcessingInterval, getSelectedOutput, processFrame, setPipeline, setProcessingInterval, toString
-
Constructor Details
-
FrcOpenCvDetector
public FrcOpenCvDetector(String instanceName, int numImageBuffers, TrcHomographyMapper.Rectangle cameraRect, TrcHomographyMapper.Rectangle worldRect, edu.wpi.first.cscore.CvSink cvSink, edu.wpi.first.cscore.CvSource cvSource) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.numImageBuffers
- specifies the number of image buffers to allocate.cameraRect
- specifies the camera rectangle for Homography Mapper, can be null if not provided.worldRect
- specifies the world rectangle for Homography Mapper, can be null if not provided.cvSink
- specifies the object to capture the video frames.cvSource
- specifies the object to stream video output.
-
-
Method Details
-
getFrame
public boolean getFrame(org.opencv.core.Mat frame) This method takes a snapshot of the video frame.- Parameters:
frame
- specifies the frame buffer to hold the video snapshot.- Returns:
- true if successful, false otherwise.
-
putFrame
public void putFrame(org.opencv.core.Mat frame) This method displays a frame buffer to the display surface.- Parameters:
frame
- specifies the video frame to be displayed.
-