diff --git a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java index c62edfa5076..699268fe4ba 100644 --- a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java +++ b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java @@ -103,8 +103,8 @@ public boolean equals(Object obj) { /** Quad threshold parameters. */ @SuppressWarnings("MemberName") public static class QuadThresholdParameters { - /** Threshold used to reject quads containing too few pixels. Default is 5 pixels. */ - public int minClusterPixels = 5; + /** Threshold used to reject quads containing too few pixels. Default is 300 pixels. */ + public int minClusterPixels = 300; /** * How many corner candidates to consider when segmenting a group of pixels into a quad. Default @@ -115,9 +115,9 @@ public static class QuadThresholdParameters { /** * Critical angle, in radians. The detector will reject quads where pairs of edges have angles * that are close to straight or close to 180 degrees. Zero means that no quads are rejected. - * Default is 10 degrees. + * Default is 45 degrees. */ - public double criticalAngle = 10 * Math.PI / 180.0; + public double criticalAngle = 45 * Math.PI / 180.0; /** * When fitting lines to the contours, the maximum mean squared error allowed. This is useful in @@ -184,6 +184,7 @@ public boolean equals(Object obj) { public AprilTagDetector() { m_native = AprilTagJNI.createDetector(); + setQuadThresholdParameters(new QuadThresholdParameters()); } @Override diff --git a/apriltag/src/main/native/cpp/AprilTagDetector.cpp b/apriltag/src/main/native/cpp/AprilTagDetector.cpp index cae9c0a5e59..036dc20431f 100644 --- a/apriltag/src/main/native/cpp/AprilTagDetector.cpp +++ b/apriltag/src/main/native/cpp/AprilTagDetector.cpp @@ -46,7 +46,9 @@ void AprilTagDetector::Results::Destroy() { } } -AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} {} +AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} { + SetQuadThresholdParameters({}); +} AprilTagDetector& AprilTagDetector::operator=(AprilTagDetector&& rhs) { Destroy(); diff --git a/apriltag/src/main/native/include/frc/apriltag/AprilTagDetector.h b/apriltag/src/main/native/include/frc/apriltag/AprilTagDetector.h index 59dedf1a7f1..29e5b79d4f8 100644 --- a/apriltag/src/main/native/include/frc/apriltag/AprilTagDetector.h +++ b/apriltag/src/main/native/include/frc/apriltag/AprilTagDetector.h @@ -83,10 +83,10 @@ class WPILIB_DLLEXPORT AprilTagDetector { bool operator==(const QuadThresholdParameters&) const = default; /** - * Threshold used to reject quads containing too few pixels. Default is 5 + * Threshold used to reject quads containing too few pixels. Default is 300 * pixels. */ - int minClusterPixels = 5; + int minClusterPixels = 300; /** * How many corner candidates to consider when segmenting a group of pixels @@ -97,9 +97,9 @@ class WPILIB_DLLEXPORT AprilTagDetector { /** * Critical angle. The detector will reject quads where pairs of edges have * angles that are close to straight or close to 180 degrees. Zero means - * that no quads are rejected. Default is 10 degrees. + * that no quads are rejected. Default is 45 degrees. */ - units::radian_t criticalAngle = 10_deg; + units::radian_t criticalAngle = 45_deg; /** * When fitting lines to the contours, the maximum mean squared error