From b3949d2120af4af1835972466ca9ed3878e7fccc Mon Sep 17 00:00:00 2001 From: s-trinh Date: Mon, 8 Apr 2019 17:57:27 +0200 Subject: [PATCH] Delete pose2.t only if a second solution has been computed. (#23) --- apriltag_pose.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apriltag_pose.c b/apriltag_pose.c index 60dbff58..d29734cf 100644 --- a/apriltag_pose.c +++ b/apriltag_pose.c @@ -517,8 +517,10 @@ double estimate_tag_pose(apriltag_detection_info_t* info, apriltag_pose_t* pose) if (err1 <= err2) { pose->R = pose1.R; pose->t = pose1.t; + if (pose2.R) { + matd_destroy(pose2.t); + } matd_destroy(pose2.R); - matd_destroy(pose2.t); return err1; } else { pose->R = pose2.R;