blob: 342e046a7087440441354e7a24cc7a3248003f9b [file] [log] [blame]
Maxwell Hendersonfebee252023-01-28 16:53:52 -08001#include "y2023/vision/aprilrobotics.h"
2
Jim Ostrowski49be8232023-03-23 01:00:14 -07003#include <opencv2/highgui.hpp>
4
milind-ua30a4a12023-03-24 20:49:41 -07005#include "y2023/vision/vision_util.h"
6
Maxwell Hendersonfebee252023-01-28 16:53:52 -08007DEFINE_bool(
8 debug, false,
9 "If true, dump a ton of debug and crash on the first valid detection.");
10
Jim Ostrowskid03f9892023-03-25 11:57:54 -070011DEFINE_double(min_decision_margin, 50.0,
milind-uf2a4e322023-02-01 19:33:10 -080012 "Minimum decision margin (confidence) for an apriltag detection");
Jim Ostrowski14124a32023-03-03 22:16:07 -080013DEFINE_int32(pixel_border, 10,
Jim Ostrowski437b1fb2023-02-26 10:12:01 -080014 "Size of image border within which to reject detected corners");
milind-u60e7fe52023-02-26 16:13:50 -080015DEFINE_double(
milind-u8773c232023-03-11 14:59:06 -080016 max_expected_distortion, 0.314,
milind-u60e7fe52023-02-26 16:13:50 -080017 "Maximum expected value for unscaled distortion factors. Will scale "
18 "distortion factors so that this value (and a higher distortion) maps to "
19 "1.0.");
milind-ude9045f2023-03-25 18:17:12 -070020DEFINE_uint64(pose_estimation_iterations, 50,
21 "Number of iterations for apriltag pose estimation.");
milind-uf2a4e322023-02-01 19:33:10 -080022
Stephan Pleinesf63bde82024-01-13 15:59:33 -080023namespace y2023::vision {
Maxwell Hendersonfebee252023-01-28 16:53:52 -080024
Austin Schuhd2667932023-02-04 16:22:39 -080025namespace chrono = std::chrono;
26
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080027// Set max age on image for processing at 20 ms. For 60Hz, we should be
28// processing at least every 16.7ms
29constexpr aos::monotonic_clock::duration kMaxImageAge =
30 std::chrono::milliseconds(20);
31
Maxwell Hendersonfebee252023-01-28 16:53:52 -080032AprilRoboticsDetector::AprilRoboticsDetector(aos::EventLoop *event_loop,
milind-ua30a4a12023-03-24 20:49:41 -070033 std::string_view channel_name,
34 bool flip_image)
James Kuszmauld67f6d22023-02-05 17:37:25 -080035 : calibration_data_(event_loop),
milind-uf5b3b4b2023-02-26 14:50:38 -080036 image_size_(0, 0),
milind-ua30a4a12023-03-24 20:49:41 -070037 flip_image_(flip_image),
38 node_name_(event_loop->node()->name()->string_view()),
Maxwell Hendersonfebee252023-01-28 16:53:52 -080039 ftrace_(),
milind-ufbc5c812023-04-06 21:24:29 -070040 image_callback_(
41 event_loop, channel_name,
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080042 [this](cv::Mat image_color_mat,
43 const aos::monotonic_clock::time_point eof) {
milind-ufbc5c812023-04-06 21:24:29 -070044 HandleImage(image_color_mat, eof);
45 },
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080046 kMaxImageAge),
Maxwell Hendersonfebee252023-01-28 16:53:52 -080047 target_map_sender_(
Yash Chainani728ae222023-02-04 19:48:12 -080048 event_loop->MakeSender<frc971::vision::TargetMap>("/camera")),
milind-u7aa29e22023-02-23 20:22:01 -080049 image_annotations_sender_(
milind-u99b1a762023-03-12 16:48:32 -070050 event_loop->MakeSender<foxglove::ImageAnnotations>("/camera")),
51 rejections_(0) {
Maxwell Hendersonfebee252023-01-28 16:53:52 -080052 tag_family_ = tag16h5_create();
53 tag_detector_ = apriltag_detector_create();
54
55 apriltag_detector_add_family_bits(tag_detector_, tag_family_, 1);
56 tag_detector_->nthreads = 6;
57 tag_detector_->wp = workerpool_create(tag_detector_->nthreads);
58 tag_detector_->qtp.min_white_black_diff = 5;
59 tag_detector_->debug = FLAGS_debug;
60
61 std::string hostname = aos::network::GetHostname();
62
63 // Check team string is valid
James Kuszmauld67f6d22023-02-05 17:37:25 -080064 calibration_ = FindCameraCalibration(
65 calibration_data_.constants(), event_loop->node()->name()->string_view());
milind-uf2a4e322023-02-01 19:33:10 -080066
67 extrinsics_ = CameraExtrinsics(calibration_);
Maxwell Hendersonfebee252023-01-28 16:53:52 -080068 intrinsics_ = CameraIntrinsics(calibration_);
milind-uf2a4e322023-02-01 19:33:10 -080069 // Create an undistort projection matrix using the intrinsics
70 projection_matrix_ = cv::Mat::zeros(3, 4, CV_64F);
71 intrinsics_.rowRange(0, 3).colRange(0, 3).copyTo(
72 projection_matrix_.rowRange(0, 3).colRange(0, 3));
73
74 dist_coeffs_ = CameraDistCoeffs(calibration_);
Maxwell Hendersonfebee252023-01-28 16:53:52 -080075
76 image_callback_.set_format(frc971::vision::ImageCallback::Format::GRAYSCALE);
77}
78
79AprilRoboticsDetector::~AprilRoboticsDetector() {
80 apriltag_detector_destroy(tag_detector_);
81 free(tag_family_);
82}
83
84void AprilRoboticsDetector::SetWorkerpoolAffinities() {
85 for (int i = 0; i < tag_detector_->wp->nthreads; i++) {
86 cpu_set_t affinity;
87 CPU_ZERO(&affinity);
88 CPU_SET(i, &affinity);
89 pthread_setaffinity_np(tag_detector_->wp->threads[i], sizeof(affinity),
90 &affinity);
91 struct sched_param param;
92 param.sched_priority = 20;
93 int res = pthread_setschedparam(tag_detector_->wp->threads[i], SCHED_FIFO,
94 &param);
95 PCHECK(res == 0) << "Failed to set priority of threadpool threads";
96 }
97}
98
milind-uf2a4e322023-02-01 19:33:10 -080099void AprilRoboticsDetector::HandleImage(cv::Mat image_grayscale,
milind-u09fb1252023-01-28 19:21:41 -0800100 aos::monotonic_clock::time_point eof) {
milind-uf5b3b4b2023-02-26 14:50:38 -0800101 image_size_ = image_grayscale.size();
102
milind-u99b1a762023-03-12 16:48:32 -0700103 DetectionResult result = DetectTags(image_grayscale, eof);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800104
105 auto builder = target_map_sender_.MakeBuilder();
106 std::vector<flatbuffers::Offset<frc971::vision::TargetPoseFbs>> target_poses;
milind-ude9045f2023-03-25 18:17:12 -0700107 for (auto &detection : result.detections) {
108 auto *fbb = builder.fbb();
109 auto pose = BuildTargetPose(detection, fbb);
110 DestroyPose(&detection.pose);
111 target_poses.emplace_back(pose);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800112 }
113 const auto target_poses_offset = builder.fbb()->CreateVector(target_poses);
114 auto target_map_builder = builder.MakeBuilder<frc971::vision::TargetMap>();
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800115 target_map_builder.add_target_poses(target_poses_offset);
milind-u09fb1252023-01-28 19:21:41 -0800116 target_map_builder.add_monotonic_timestamp_ns(eof.time_since_epoch().count());
milind-u99b1a762023-03-12 16:48:32 -0700117 target_map_builder.add_rejections(result.rejections);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800118 builder.CheckOk(builder.Send(target_map_builder.Finish()));
119}
120
121flatbuffers::Offset<frc971::vision::TargetPoseFbs>
milind-ufc8ab702023-02-26 14:14:39 -0800122AprilRoboticsDetector::BuildTargetPose(const Detection &detection,
milind-u681c4712023-02-23 21:22:50 -0800123 flatbuffers::FlatBufferBuilder *fbb) {
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800124 const auto T =
milind-ufc8ab702023-02-26 14:14:39 -0800125 Eigen::Translation3d(detection.pose.t->data[0], detection.pose.t->data[1],
126 detection.pose.t->data[2]);
milind-u3f5f83c2023-01-29 15:23:51 -0800127 const auto position_offset =
128 frc971::vision::CreatePosition(*fbb, T.x(), T.y(), T.z());
129
milind-u633c4c02023-02-25 22:51:45 -0800130 // Aprilrobotics stores the rotation matrix in row-major order
131 const auto orientation = Eigen::Quaterniond(
milind-ufc8ab702023-02-26 14:14:39 -0800132 Eigen::Matrix<double, 3, 3, Eigen::RowMajor>(detection.pose.R->data));
milind-u3f5f83c2023-01-29 15:23:51 -0800133 const auto orientation_offset = frc971::vision::CreateQuaternion(
134 *fbb, orientation.w(), orientation.x(), orientation.y(), orientation.z());
135
milind-u681c4712023-02-23 21:22:50 -0800136 return frc971::vision::CreateTargetPoseFbs(
milind-ufc8ab702023-02-26 14:14:39 -0800137 *fbb, detection.det.id, position_offset, orientation_offset,
milind-uf5b3b4b2023-02-26 14:50:38 -0800138 detection.det.decision_margin, detection.pose_error,
milind-ude9045f2023-03-25 18:17:12 -0700139 detection.distortion_factor, detection.pose_error_ratio);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800140}
141
milind-uf2a4e322023-02-01 19:33:10 -0800142void AprilRoboticsDetector::UndistortDetection(
143 apriltag_detection_t *det) const {
144 // 4 corners
145 constexpr size_t kRows = 4;
146 // 2d points
147 constexpr size_t kCols = 2;
148
149 cv::Mat distorted_points(kRows, kCols, CV_64F, det->p);
150 cv::Mat undistorted_points = cv::Mat::zeros(kRows, kCols, CV_64F);
151
152 // Undistort the april tag points
153 cv::undistortPoints(distorted_points, undistorted_points, intrinsics_,
154 dist_coeffs_, cv::noArray(), projection_matrix_);
155
156 // Copy the undistorted points into det
157 for (size_t i = 0; i < kRows; i++) {
158 for (size_t j = 0; j < kCols; j++) {
159 det->p[i][j] = undistorted_points.at<double>(i, j);
160 }
161 }
162}
163
milind-uf5b3b4b2023-02-26 14:50:38 -0800164double AprilRoboticsDetector::ComputeDistortionFactor(
165 const std::vector<cv::Point2f> &orig_corners,
166 const std::vector<cv::Point2f> &corners) {
167 CHECK_EQ(orig_corners.size(), 4ul);
168 CHECK_EQ(corners.size(), 4ul);
169
170 double avg_distance = 0.0;
171 for (size_t i = 0; i < corners.size(); i++) {
172 avg_distance += cv::norm(orig_corners[i] - corners[i]);
173 }
174 avg_distance /= corners.size();
175
milind-u8773c232023-03-11 14:59:06 -0800176 // Normalize avg_distance by dividing by the image diagonal,
177 // and then the maximum expected distortion
milind-uf5b3b4b2023-02-26 14:50:38 -0800178 double distortion_factor =
179 avg_distance /
milind-u8773c232023-03-11 14:59:06 -0800180 cv::norm(cv::Point2d(image_size_.width, image_size_.height));
milind-u60e7fe52023-02-26 16:13:50 -0800181 return std::min(distortion_factor / FLAGS_max_expected_distortion, 1.0);
milind-uf5b3b4b2023-02-26 14:50:38 -0800182}
183
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800184std::vector<cv::Point2f> AprilRoboticsDetector::MakeCornerVector(
185 const apriltag_detection_t *det) {
186 std::vector<cv::Point2f> corner_points;
187 corner_points.emplace_back(det->p[0][0], det->p[0][1]);
188 corner_points.emplace_back(det->p[1][0], det->p[1][1]);
189 corner_points.emplace_back(det->p[2][0], det->p[2][1]);
190 corner_points.emplace_back(det->p[3][0], det->p[3][1]);
191
192 return corner_points;
193}
194
milind-ude9045f2023-03-25 18:17:12 -0700195void AprilRoboticsDetector::DestroyPose(apriltag_pose_t *pose) const {
196 matd_destroy(pose->R);
197 matd_destroy(pose->t);
198}
199
milind-u99b1a762023-03-12 16:48:32 -0700200AprilRoboticsDetector::DetectionResult AprilRoboticsDetector::DetectTags(
milind-ufc8ab702023-02-26 14:14:39 -0800201 cv::Mat image, aos::monotonic_clock::time_point eof) {
Jim Ostrowski49be8232023-03-23 01:00:14 -0700202 cv::Mat color_image;
203 cvtColor(image, color_image, cv::COLOR_GRAY2RGB);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800204 const aos::monotonic_clock::time_point start_time =
205 aos::monotonic_clock::now();
206
207 image_u8_t im = {
milind-u09fb1252023-01-28 19:21:41 -0800208 .width = image.cols,
209 .height = image.rows,
210 .stride = image.cols,
211 .buf = image.data,
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800212 };
Jim Ostrowski437b1fb2023-02-26 10:12:01 -0800213 const uint32_t min_x = FLAGS_pixel_border;
214 const uint32_t max_x = image.cols - FLAGS_pixel_border;
Jim Ostrowski0197d6b2023-03-04 12:41:13 -0800215 const uint32_t min_y = FLAGS_pixel_border;
216 const uint32_t max_y = image.rows - FLAGS_pixel_border;
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800217
218 ftrace_.FormatMessage("Starting detect\n");
219 zarray_t *detections = apriltag_detector_detect(tag_detector_, &im);
220 ftrace_.FormatMessage("Done detecting\n");
221
milind-ufc8ab702023-02-26 14:14:39 -0800222 std::vector<Detection> results;
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800223
milind-u7aa29e22023-02-23 20:22:01 -0800224 auto builder = image_annotations_sender_.MakeBuilder();
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800225 std::vector<flatbuffers::Offset<foxglove::PointsAnnotation>> foxglove_corners;
Yash Chainani728ae222023-02-04 19:48:12 -0800226
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800227 for (int i = 0; i < zarray_size(detections); i++) {
228 apriltag_detection_t *det;
229 zarray_get(detections, i, &det);
230
milind-uf2a4e322023-02-01 19:33:10 -0800231 if (det->decision_margin > FLAGS_min_decision_margin) {
Jim Ostrowski437b1fb2023-02-26 10:12:01 -0800232 if (det->p[0][0] < min_x || det->p[0][0] > max_x ||
233 det->p[1][0] < min_x || det->p[1][0] > max_x ||
234 det->p[2][0] < min_x || det->p[2][0] > max_x ||
Jim Ostrowski0197d6b2023-03-04 12:41:13 -0800235 det->p[3][0] < min_x || det->p[3][0] > max_x ||
236 det->p[0][1] < min_y || det->p[0][1] > max_y ||
237 det->p[1][1] < min_y || det->p[1][1] > max_y ||
238 det->p[2][1] < min_y || det->p[2][1] > max_y ||
239 det->p[3][1] < min_y || det->p[3][1] > max_y) {
Jim Ostrowski437b1fb2023-02-26 10:12:01 -0800240 VLOG(1) << "Rejecting detection because corner is outside pixel border";
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800241 // Send rejected corner points in red
242 std::vector<cv::Point2f> rejected_corner_points = MakeCornerVector(det);
243 foxglove_corners.push_back(frc971::vision::BuildPointsAnnotation(
244 builder.fbb(), eof, rejected_corner_points,
245 std::vector<double>{1.0, 0.0, 0.0, 0.5}));
Jim Ostrowski437b1fb2023-02-26 10:12:01 -0800246 continue;
247 }
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800248 VLOG(1) << "Found tag number " << det->id << " hamming: " << det->hamming
249 << " margin: " << det->decision_margin;
250
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800251 // First create an apriltag_detection_info_t struct using your known
252 // parameters.
253 apriltag_detection_info_t info;
254 info.det = det;
255 info.tagsize = 0.1524;
milind-uf2a4e322023-02-01 19:33:10 -0800256
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800257 info.fx = intrinsics_.at<double>(0, 0);
258 info.fy = intrinsics_.at<double>(1, 1);
259 info.cx = intrinsics_.at<double>(0, 2);
260 info.cy = intrinsics_.at<double>(1, 2);
261
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800262 // Send original corner points in green
263 std::vector<cv::Point2f> orig_corner_points = MakeCornerVector(det);
264 foxglove_corners.push_back(frc971::vision::BuildPointsAnnotation(
265 builder.fbb(), eof, orig_corner_points,
266 std::vector<double>{0.0, 1.0, 0.0, 0.5}));
Jim Ostrowskid2b5c912023-02-26 00:59:35 -0800267
milind-ueccac3c2023-02-25 20:54:47 -0800268 UndistortDetection(det);
269
milind-uf5b3b4b2023-02-26 14:50:38 -0800270 const aos::monotonic_clock::time_point before_pose_estimation =
271 aos::monotonic_clock::now();
272
milind-ude9045f2023-03-25 18:17:12 -0700273 apriltag_pose_t pose_1;
274 apriltag_pose_t pose_2;
275 double pose_error_1;
276 double pose_error_2;
277 estimate_tag_pose_orthogonal_iteration(&info, &pose_error_1, &pose_1,
278 &pose_error_2, &pose_2,
279 FLAGS_pose_estimation_iterations);
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800280
281 const aos::monotonic_clock::time_point after_pose_estimation =
282 aos::monotonic_clock::now();
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800283 VLOG(1) << "Took "
Austin Schuhd2667932023-02-04 16:22:39 -0800284 << chrono::duration<double>(after_pose_estimation -
285 before_pose_estimation)
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800286 .count()
287 << " seconds for pose estimation";
milind-ude9045f2023-03-25 18:17:12 -0700288 VLOG(1) << "Pose err 1: " << pose_error_1;
289 VLOG(1) << "Pose err 2: " << pose_error_2;
Yash Chainani728ae222023-02-04 19:48:12 -0800290
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800291 // Send undistorted corner points in pink
292 std::vector<cv::Point2f> corner_points = MakeCornerVector(det);
293 foxglove_corners.push_back(frc971::vision::BuildPointsAnnotation(
294 builder.fbb(), eof, corner_points,
295 std::vector<double>{1.0, 0.75, 0.8, 1.0}));
milind-uf5b3b4b2023-02-26 14:50:38 -0800296
297 double distortion_factor =
298 ComputeDistortionFactor(orig_corner_points, corner_points);
299
milind-ude9045f2023-03-25 18:17:12 -0700300 // We get two estimates for poses.
301 // Choose the one with the lower estimation error
302 bool use_pose_1 = (pose_error_1 < pose_error_2);
303 auto best_pose = (use_pose_1 ? pose_1 : pose_2);
304 auto secondary_pose = (use_pose_1 ? pose_2 : pose_1);
305 double best_pose_error = (use_pose_1 ? pose_error_1 : pose_error_2);
306 double secondary_pose_error = (use_pose_1 ? pose_error_2 : pose_error_1);
307
308 CHECK_NE(best_pose_error, std::numeric_limits<double>::infinity())
309 << "Got no valid pose estimations, this should not be possible.";
310 double pose_error_ratio = best_pose_error / secondary_pose_error;
311
312 // Destroy the secondary pose if we got one
313 if (secondary_pose_error != std::numeric_limits<double>::infinity()) {
314 DestroyPose(&secondary_pose);
315 }
316
milind-uf5b3b4b2023-02-26 14:50:38 -0800317 results.emplace_back(Detection{.det = *det,
milind-ude9045f2023-03-25 18:17:12 -0700318 .pose = best_pose,
319 .pose_error = best_pose_error,
320 .distortion_factor = distortion_factor,
321 .pose_error_ratio = pose_error_ratio});
322
Jim Ostrowski49be8232023-03-23 01:00:14 -0700323 if (FLAGS_visualize) {
324 // Draw raw (distorted) corner points in green
325 cv::line(color_image, orig_corner_points[0], orig_corner_points[1],
326 cv::Scalar(0, 255, 0), 2);
327 cv::line(color_image, orig_corner_points[1], orig_corner_points[2],
328 cv::Scalar(0, 255, 0), 2);
329 cv::line(color_image, orig_corner_points[2], orig_corner_points[3],
330 cv::Scalar(0, 255, 0), 2);
331 cv::line(color_image, orig_corner_points[3], orig_corner_points[0],
332 cv::Scalar(0, 255, 0), 2);
333
334 // Draw undistorted corner points in red
335 cv::line(color_image, corner_points[0], corner_points[1],
336 cv::Scalar(0, 0, 255), 2);
337 cv::line(color_image, corner_points[2], corner_points[1],
338 cv::Scalar(0, 0, 255), 2);
339 cv::line(color_image, corner_points[2], corner_points[3],
340 cv::Scalar(0, 0, 255), 2);
341 cv::line(color_image, corner_points[0], corner_points[3],
342 cv::Scalar(0, 0, 255), 2);
343 }
344
345 VLOG(1) << "Found tag number " << det->id << " hamming: " << det->hamming
346 << " margin: " << det->decision_margin;
347
milind-u99b1a762023-03-12 16:48:32 -0700348 } else {
349 rejections_++;
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800350 }
351 }
Jim Ostrowski49be8232023-03-23 01:00:14 -0700352 if (FLAGS_visualize) {
353 // Display the result
354 // Rotate by 180 degrees to make it upright
milind-ua30a4a12023-03-24 20:49:41 -0700355 if (flip_image_) {
356 cv::rotate(color_image, color_image, 1);
357 }
358 cv::imshow(absl::StrCat("AprilRoboticsDetector Image ", node_name_),
359 color_image);
Jim Ostrowski49be8232023-03-23 01:00:14 -0700360 }
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800361
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800362 const auto corners_offset = builder.fbb()->CreateVector(foxglove_corners);
Yash Chainani10b7b022023-02-22 14:34:04 -0800363 foxglove::ImageAnnotations::Builder annotation_builder(*builder.fbb());
Jim Ostrowski5e2c5e62023-02-26 12:52:56 -0800364 annotation_builder.add_points(corners_offset);
365 builder.CheckOk(builder.Send(annotation_builder.Finish()));
Yash Chainani728ae222023-02-04 19:48:12 -0800366
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800367 apriltag_detections_destroy(detections);
368
369 const aos::monotonic_clock::time_point end_time = aos::monotonic_clock::now();
370
milind-uf3ab8ba2023-02-04 17:56:16 -0800371 if (FLAGS_debug) {
372 timeprofile_display(tag_detector_->tp);
373 }
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800374
Austin Schuhd2667932023-02-04 16:22:39 -0800375 VLOG(1) << "Took " << chrono::duration<double>(end_time - start_time).count()
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800376 << " seconds to detect overall";
377
milind-u99b1a762023-03-12 16:48:32 -0700378 return {.detections = results, .rejections = rejections_};
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800379}
380
Stephan Pleinesf63bde82024-01-13 15:59:33 -0800381} // namespace y2023::vision