Add confidence flag to TargetEstimate
Sigmoid function used to convert a final cost to a confidence from 0-1.
Signed-off-by: Milind Upadhyay <milind.upadhyay@gmail.com>
Change-Id: Ia71b8542c4f14a2a6678b68f0aff3cff41e65f8c
diff --git a/y2022/vision/target_estimator.h b/y2022/vision/target_estimator.h
index 4303b24..5d338c4 100644
--- a/y2022/vision/target_estimator.h
+++ b/y2022/vision/target_estimator.h
@@ -10,6 +10,7 @@
#include "y2022/vision/target_estimate_generated.h"
namespace y2022::vision {
+
// Class to estimate the polar coordinates and rotation from the camera to the
// target.
class TargetEstimator {
@@ -45,6 +46,8 @@
inline double angle_to_target() const { return M_PI - yaw_; }
inline double camera_height() const { return camera_height_; }
+ inline double confidence() const { return confidence_; }
+
// Draws the distance, angle, and rotation on the given image
static void DrawEstimate(const TargetEstimate &target_estimate,
cv::Mat view_image);
@@ -79,6 +82,7 @@
double distance_;
double angle_to_camera_;
double camera_height_;
+ double confidence_;
};
} // namespace y2022::vision