Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QuadThresholdParameters to AprilTag config #1519

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected List<AprilTagDetection> process(CVMat in) {
public void setParams(AprilTagDetectionPipeParams newParams) {
if (this.params == null || !this.params.equals(newParams)) {
m_detector.setConfig(newParams.detectorParams);
m_detector.setQuadThresholdParameters(newParams.quadParams);

m_detector.clearFamilies();
m_detector.addFamily(newParams.family.getNativeName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
public class AprilTagDetectionPipeParams {
public final AprilTagFamily family;
public final AprilTagDetector.Config detectorParams;
public final AprilTagDetector.QuadThresholdParameters quadParams;

public AprilTagDetectionPipeParams(AprilTagFamily tagFamily, AprilTagDetector.Config config) {
public AprilTagDetectionPipeParams(
AprilTagFamily tagFamily,
AprilTagDetector.Config config,
AprilTagDetector.QuadThresholdParameters quadParams) {
this.family = tagFamily;
this.detectorParams = config;
this.quadParams = quadParams;
}

@Override
Expand All @@ -45,8 +50,27 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
AprilTagDetectionPipeParams other = (AprilTagDetectionPipeParams) obj;
if (family != other.family) return false;

boolean sameQuadParams = false;
boolean sameDetectorParams = false;
if (detectorParams == null) {
crschardt marked this conversation as resolved.
Show resolved Hide resolved
return other.detectorParams == null;
} else return detectorParams.equals(other.detectorParams);
if (other.detectorParams == null) {
sameDetectorParams = true;
} else {
return false;
}
} else {
sameDetectorParams = detectorParams.equals(other.detectorParams);
}
if (quadParams == null) {
if (other.quadParams == null) {
sameQuadParams = true;
} else {
return false;
}
} else {
sameQuadParams = quadParams.equals(other.quadParams);
}
return (sameDetectorParams) && (sameQuadParams);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ protected void setPipeParamsImpl() {
config.refineEdges = settings.refineEdges;
config.quadSigma = (float) settings.blur;
config.quadDecimate = settings.decimate;
aprilTagDetectionPipe.setParams(new AprilTagDetectionPipeParams(settings.tagFamily, config));

var quadParams = new AprilTagDetector.QuadThresholdParameters();
quadParams.minClusterPixels = 5;
crschardt marked this conversation as resolved.
Show resolved Hide resolved

aprilTagDetectionPipe.setParams(
new AprilTagDetectionPipeParams(settings.tagFamily, config, quadParams));

if (frameStaticProperties.cameraCalibration != null) {
var cameraMatrix = frameStaticProperties.cameraCalibration.getCameraIntrinsicsMat();
Expand Down
Loading