Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 1 | #ifndef Y2024_VISION_VISION_UTIL_H_ |
| 2 | #define Y2024_VISION_VISION_UTIL_H_ |
Jim Ostrowski | 6772628 | 2024-03-24 14:39:33 -0700 | [diff] [blame^] | 3 | #include <map> |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 4 | #include <string_view> |
| 5 | |
| 6 | #include "opencv2/imgproc.hpp" |
| 7 | |
| 8 | #include "y2024/constants/constants_generated.h" |
| 9 | |
| 10 | namespace y2024::vision { |
| 11 | |
Jim Ostrowski | 6772628 | 2024-03-24 14:39:33 -0700 | [diff] [blame^] | 12 | // Generate unique colors for each camera |
| 13 | const 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 |
| 21 | struct 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 | |
| 30 | std::vector<CameraNode> CreateNodeList(); |
| 31 | |
| 32 | std::map<std::string, int> CreateOrderingMap( |
| 33 | std::vector<CameraNode> &node_list); |
| 34 | |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 35 | const frc971::vision::calibration::CameraCalibration *FindCameraCalibration( |
Jim Ostrowski | ddebdcb | 2024-02-29 22:25:36 -0800 | [diff] [blame] | 36 | const y2024::Constants &calibration_data, std::string_view node_name, |
| 37 | int camera_number); |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 38 | |
| 39 | } // namespace y2024::vision |
| 40 | |
| 41 | #endif // Y2024_VISION_VISION_UTIL_H_ |