From 2881741226235c3e8844067320c2ebdc4faf6960 Mon Sep 17 00:00:00 2001 From: amquake Date: Sat, 7 Oct 2023 17:59:19 -0700 Subject: [PATCH] Fix false-positive vision estimation edgecase (#932) > there is a problem if the found tags are a valid one plus an invalid tag, so eg it sees a tag but finds noise on the wall, and so lists tags 2 and 15. Lines 90-99 will ignore tag 15, and put 4 corners into the list. It will get past the test on line 100 (there are 4 corners). BUT then at line 106, there are 2 entries in visTags, so it will go to the "else" and try to use solvePNP_SQPNP(). --- .../main/java/org/photonvision/estimation/VisionEstimation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photon-lib/src/main/java/org/photonvision/estimation/VisionEstimation.java b/photon-lib/src/main/java/org/photonvision/estimation/VisionEstimation.java index f5fdb2953d..3c9c2c152c 100644 --- a/photon-lib/src/main/java/org/photonvision/estimation/VisionEstimation.java +++ b/photon-lib/src/main/java/org/photonvision/estimation/VisionEstimation.java @@ -103,7 +103,7 @@ public static PNPResults estimateCamPosePNP( Point[] points = OpenCVHelp.cornersToPoints(corners); // single-tag pnp - if (visTags.size() == 1) { + if (knownTags.size() == 1) { var camToTag = OpenCVHelp.solvePNP_SQUARE( cameraMatrix, distCoeffs, TargetModel.kTag16h5.vertices, points);