Package ftclib.vision
Class FtcVisionEocvColorBlob
java.lang.Object
ftclib.vision.FtcVisionEocvColorBlob
This class encapsulates the EocvColorBlob vision processor to make all vision processors conform to our framework
library. By doing so, one can switch between different vision processors and have access to a common interface.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This interface provides a method for filtering false positive objects in the detected target list. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FtcEocvColorBlobProcessor
private final TrcHomographyMapper
private final String
final TrcDbgTrace
-
Constructor Summary
ConstructorsConstructorDescriptionFtcVisionEocvColorBlob
(String instanceName, Integer colorConversion, double[] colorThresholds, TrcOpenCvColorBlobPipeline.FilterContourParams filterContourParams, boolean externalContourOnly) Constructor: Create an instance of the object.FtcVisionEocvColorBlob
(String instanceName, Integer colorConversion, double[] colorThresholds, TrcOpenCvColorBlobPipeline.FilterContourParams filterContourParams, boolean externalContourOnly, TrcHomographyMapper.Rectangle cameraRect, TrcHomographyMapper.Rectangle worldRect, boolean annotate) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiongetBestDetectedTargetInfo
(FtcVisionEocvColorBlob.FilterTarget filter, Comparator<? super TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject>> comparator, double objGroundOffset, double cameraHeight) This method returns the target info of the best detected target.getDetectedTargetInfo
(TrcOpenCvColorBlobPipeline.DetectedObject target, double objGroundOffset, double cameraHeight) This method returns the target info of the given detected target.getDetectedTargetsInfo
(FtcVisionEocvColorBlob.FilterTarget filter, Comparator<? super TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject>> comparator, double objGroundOffset, double cameraHeight) This method returns an array list of target info on the filtered detected targets.This method returns the Color Blob vision processor.org.opencv.core.Point
mapPoint
(org.opencv.core.Point point) This method maps a camera screen point to the real world point using homography.toString()
This method returns the pipeline instance name.
-
Field Details
-
colorBlobProcessor
-
tracer
-
instanceName
-
homographyMapper
-
-
Constructor Details
-
FtcVisionEocvColorBlob
public FtcVisionEocvColorBlob(String instanceName, Integer colorConversion, double[] colorThresholds, TrcOpenCvColorBlobPipeline.FilterContourParams filterContourParams, boolean externalContourOnly, TrcHomographyMapper.Rectangle cameraRect, TrcHomographyMapper.Rectangle worldRect, boolean annotate) 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).cameraRect
- specifies the camera rectangle for Homography Mapper, null if not provided.worldRect
- specifies the world rectangle for Homography Mapper, null if not provided.annotate
- specifies true to draw annotation, false otherwise.
-
FtcVisionEocvColorBlob
public FtcVisionEocvColorBlob(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. -
getVisionProcessor
This method returns the Color Blob vision processor.- Returns:
- ColorBlob vision processor.
-
getDetectedTargetInfo
public TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject> getDetectedTargetInfo(TrcOpenCvColorBlobPipeline.DetectedObject target, double objGroundOffset, double cameraHeight) This method returns the target info of the given detected target.- Parameters:
target
- specifies the detected targetobjGroundOffset
- specifies the object ground offset above the floor.cameraHeight
- specifies the height of the camera above the floor.- Returns:
- information about the detected target.
-
getDetectedTargetsInfo
public ArrayList<TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject>> getDetectedTargetsInfo(FtcVisionEocvColorBlob.FilterTarget filter, Comparator<? super TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject>> comparator, double objGroundOffset, double cameraHeight) This method returns an array list of target info on the filtered detected targets.- Parameters:
filter
- specifies the filter to call to filter out false positive targets.comparator
- specifies the comparator to sort the array if provided, can be null if not provided.objGroundOffset
- specifies the object ground offset above the floor.cameraHeight
- specifies the height of the camera above the floor.- Returns:
- filtered target info array list.
-
getBestDetectedTargetInfo
public TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject> getBestDetectedTargetInfo(FtcVisionEocvColorBlob.FilterTarget filter, Comparator<? super TrcVisionTargetInfo<TrcOpenCvColorBlobPipeline.DetectedObject>> comparator, double objGroundOffset, double cameraHeight) This method returns the target info of the best detected target.- Parameters:
filter
- specifies the filter to call to filter out false positive targets.comparator
- specifies the comparator to sort the array if provided, can be null if not provided.objGroundOffset
- specifies the object ground offset above the floor.cameraHeight
- specifies the height of the camera above the floor.- Returns:
- information about the best detected target.
-
mapPoint
public org.opencv.core.Point mapPoint(org.opencv.core.Point point) This method maps a camera screen point to the real world point using homography.- Parameters:
point
- specifies the camera screen point.- Returns:
- real world coordinate point.
-