Package edu.wpi.first.apriltag
Class AprilTagDetector
java.lang.Object
edu.wpi.first.apriltag.AprilTagDetector
- All Implemented Interfaces:
AutoCloseable
public class AprilTagDetector extends Object implements AutoCloseable
An AprilTag detector engine. This is expensive to set up and tear down, so most use cases should
only create one of these, add a family to it, set up any other configuration, and repeatedly call
Detect().
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AprilTagDetector.Config
Detector configuration.static class
AprilTagDetector.QuadThresholdParameters
Quad threshold parameters. -
Constructor Summary
Constructors Constructor Description AprilTagDetector()
Constructs an AprilTagDetector. -
Method Summary
Modifier and Type Method Description void
addFamily(String fam)
Adds a family of tags to be detected.void
addFamily(String fam, int bitsCorrected)
Adds a family of tags to be detected.void
clearFamilies()
Unregister all families.void
close()
AprilTagDetection[]
detect(Mat img)
Detect tags from an 8-bit image.AprilTagDetector.Config
getConfig()
Gets detector configuration.AprilTagDetector.QuadThresholdParameters
getQuadThresholdParameters()
Gets quad threshold parameters.void
removeFamily(String fam)
Removes a family of tags from the detector.void
setConfig(AprilTagDetector.Config config)
Sets detector configuration.void
setQuadThresholdParameters(AprilTagDetector.QuadThresholdParameters params)
Sets quad threshold parameters.
-
Constructor Details
-
AprilTagDetector
public AprilTagDetector()Constructs an AprilTagDetector.
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setConfig
Sets detector configuration.- Parameters:
config
- Configuration
-
getConfig
Gets detector configuration.- Returns:
- Configuration
-
setQuadThresholdParameters
Sets quad threshold parameters.- Parameters:
params
- Parameters
-
getQuadThresholdParameters
Gets quad threshold parameters.- Returns:
- Parameters
-
addFamily
Adds a family of tags to be detected.- Parameters:
fam
- Family name, e.g. "tag16h5"- Throws:
IllegalArgumentException
- if family name not recognized
-
addFamily
Adds a family of tags to be detected.- Parameters:
fam
- Family name, e.g. "tag16h5"bitsCorrected
- Maximum number of bits to correct- Throws:
IllegalArgumentException
- if family name not recognized
-
removeFamily
Removes a family of tags from the detector.- Parameters:
fam
- Family name, e.g. "tag16h5"
-
clearFamilies
Unregister all families. -
detect
Detect tags from an 8-bit image.The image must be grayscale.
- Parameters:
img
- 8-bit OpenCV Mat image- Returns:
- Results (array of AprilTagDetection)
-