Fix various bugs in vision code
- Keep outdoors on because that's used now
- Don't convert distortion coeffs to doubles
- Actually seed angles correctly when frozen
- Don't draw unused absolute centroid
Signed-off-by: Milind Upadhyay <milind.upadhyay@gmail.com>
Change-Id: I606b4d2853d04649029813eb4349f88a57791a62
diff --git a/y2022/vision/blob_detector.cc b/y2022/vision/blob_detector.cc
index 9800ace..60af1f8 100644
--- a/y2022/vision/blob_detector.cc
+++ b/y2022/vision/blob_detector.cc
@@ -12,7 +12,7 @@
#include "y2022/vision/geometry.h"
DEFINE_bool(
- use_outdoors, false,
+ use_outdoors, true,
"If set, use the color filters and exposure for an outdoor setting.");
DEFINE_int32(red_delta, 50, "Required difference between green pixels vs. red");
DEFINE_int32(blue_delta, -20,
@@ -247,10 +247,6 @@
cv::circle(view_image, stats.centroid, kCircleRadius, cv::Scalar(0, 255, 0),
cv::FILLED);
}
-
- // Draw average centroid
- cv::circle(view_image, blob_result.centroid, kCircleRadius,
- cv::Scalar(255, 255, 0), cv::FILLED);
}
void BlobDetector::ExtractBlobs(cv::Mat bgr_image,
diff --git a/y2022/vision/camera_reader.h b/y2022/vision/camera_reader.h
index 6a00351..7128890 100644
--- a/y2022/vision/camera_reader.h
+++ b/y2022/vision/camera_reader.h
@@ -97,7 +97,6 @@
const cv::Mat result(5, 1, CV_32F,
const_cast<void *>(static_cast<const void *>(
camera_calibration_->dist_coeffs()->data())));
- result.convertTo(result, CV_64F);
CHECK_EQ(result.total(), camera_calibration_->dist_coeffs()->size());
return result;
}
diff --git a/y2022/vision/target_estimator.cc b/y2022/vision/target_estimator.cc
index ba399b7..fa807f9 100644
--- a/y2022/vision/target_estimator.cc
+++ b/y2022/vision/target_estimator.cc
@@ -200,10 +200,16 @@
// Constrain the rotation to be around the localizer's, otherwise there can be
// multiple solutions. There shouldn't be too much roll or pitch
+ if (FLAGS_freeze_roll) {
+ roll_ = roll_seed;
+ }
constexpr double kMaxRollDelta = 0.1;
SetBoundsOrFreeze(&roll_, FLAGS_freeze_roll, roll_seed - kMaxRollDelta,
roll_seed + kMaxRollDelta, &problem);
+ if (FLAGS_freeze_pitch) {
+ pitch_ = pitch_seed;
+ }
constexpr double kMaxPitchDelta = 0.15;
SetBoundsOrFreeze(&pitch_, FLAGS_freeze_pitch, pitch_seed - kMaxPitchDelta,
pitch_seed + kMaxPitchDelta, &problem);