blob: fc0f29cba84f4c8ce7fcc4ad8e35169e71192ee0 [file] [log] [blame]
James (Peilun) Lia70e5752024-09-18 20:43:00 -07001#ifndef Y2024_BOT3_VISION_VISION_UTIL_H_
2#define Y2024_BOT3_VISION_VISION_UTIL_H_
3#include <map>
4#include <string_view>
5
6#include "opencv2/imgproc.hpp"
7
8#include "y2024_bot3/constants/constants_generated.h"
9
10namespace y2024_bot3::vision {
11
12// Generate unique colors for each camera
13const auto kOrinColors = std::map<std::string, cv::Scalar>{
14 {"/orin1/camera0", cv::Scalar(255, 0, 255)},
15 {"/orin1/camera1", cv::Scalar(255, 255, 0)},
16 {"/imu/camera0", cv::Scalar(0, 255, 255)},
17 {"/imu/camera1", cv::Scalar(255, 165, 0)},
18};
19
20// Structure to store node name (e.g., orin1, imu), number, and a usable string
21struct CameraNode {
22 std::string node_name;
23 int camera_number;
24
25 inline const std::string camera_name() const {
26 return "/" + node_name + "/camera" + std::to_string(camera_number);
27 }
28};
29
30std::vector<CameraNode> CreateNodeList();
31
32std::map<std::string, int> CreateOrderingMap(
33 std::vector<CameraNode> &node_list);
34
35const frc971::vision::calibration::CameraCalibration *FindCameraCalibration(
36 const y2024_bot3::Constants &calibration_data, std::string_view node_name,
37 int camera_number);
38
39} // namespace y2024_bot3::vision
40
41#endif // Y2024_BOT3_VISION_VISION_UTIL_H_