diff --git a/configs/ascento.yaml b/configs/ascento.yaml index 07d6c29..69ff45c 100644 --- a/configs/ascento.yaml +++ b/configs/ascento.yaml @@ -52,6 +52,7 @@ second_tolerance: 100 # 远距离射击容差,degree judge_distance: 2 #距离判断阈值 auto_fire: true # 是否由自瞄控制射击 +rotate_180: false camera_name: "hikrobot" exposure_ms: 2 gain: 16 diff --git a/configs/calibration.yaml b/configs/calibration.yaml index 7a40478..20d0f1d 100644 --- a/configs/calibration.yaml +++ b/configs/calibration.yaml @@ -5,6 +5,7 @@ pattern_type: chessboard # circles_grid | chessboard R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1] +rotate_180: false camera_name: "hikrobot" exposure_ms: 3 gain: 10.0 diff --git a/configs/camera.yaml b/configs/camera.yaml index cddfc59..e7d999c 100644 --- a/configs/camera.yaml +++ b/configs/camera.yaml @@ -3,6 +3,7 @@ # gamma: 0.5 # vid_pid: "f622:d13a" +rotate_180: false camera_name: "hikrobot" exposure_ms: 3 gain: 10.0 diff --git a/configs/demo.yaml b/configs/demo.yaml index af8ce21..2465ef2 100644 --- a/configs/demo.yaml +++ b/configs/demo.yaml @@ -52,6 +52,7 @@ second_tolerance: 2 # 远距离射击容差,degree judge_distance: 2 #距离判断阈值 auto_fire: true # 是否由自瞄控制射击 +rotate_180: false camera_name: "hikrobot" exposure_ms: 2 gain: 16 diff --git a/configs/example.yaml b/configs/example.yaml index 8d8fea5..7e146c8 100644 --- a/configs/example.yaml +++ b/configs/example.yaml @@ -30,6 +30,7 @@ usb_gamma: 160 usb_gain: 10 #0-96 #####-----工业相机参数-----##### +rotate_180: false camera_name: "mindvision" exposure_ms: 2 gamma: 0.5 diff --git a/configs/mvs.yaml b/configs/mvs.yaml index 76dd5b8..9681a15 100644 --- a/configs/mvs.yaml +++ b/configs/mvs.yaml @@ -37,6 +37,7 @@ usb_gamma: 160 usb_gain: 10 #0-96 #####-----工业相机参数-----##### +rotate_180: false camera_name: "hikrobot" exposure_ms: 2 gain: 16 diff --git a/configs/sentry.yaml b/configs/sentry.yaml index 6c8b88f..6fb0e21 100644 --- a/configs/sentry.yaml +++ b/configs/sentry.yaml @@ -51,6 +51,7 @@ second_tolerance: 2 # 远距离射击容差,degree judge_distance: 2 #距离判断阈值 auto_fire: true # 是否由自瞄控制射击 +rotate_180: false camera_name: "hikrobot" exposure_ms: 2.5 gain: 16.9 diff --git a/configs/standard3.yaml b/configs/standard3.yaml index 9b2afed..8323759 100644 --- a/configs/standard3.yaml +++ b/configs/standard3.yaml @@ -51,6 +51,7 @@ second_tolerance: 2 # 远距离射击容差,degree judge_distance: 2 #距离判断阈值 auto_fire: true # 是否由自瞄控制射击 +rotate_180: false camera_name: "hikrobot" exposure_ms: 2.5 gain: 16.9 diff --git a/configs/standard4.yaml b/configs/standard4.yaml index bc6565a..8ba539e 100644 --- a/configs/standard4.yaml +++ b/configs/standard4.yaml @@ -52,6 +52,7 @@ second_tolerance: 2 # 远距离射击容差,degree judge_distance: 2 #距离判断阈值 auto_fire: true # 是否由自瞄控制射击 +rotate_180: false camera_name: "hikrobot" exposure_ms: 2 gain: 16 diff --git a/configs/uav.yaml b/configs/uav.yaml index f9bdd31..4808cba 100644 --- a/configs/uav.yaml +++ b/configs/uav.yaml @@ -22,6 +22,7 @@ roi: use_roi: false #####-----工业相机参数-----##### +rotate_180: false camera_name: "mindvision" exposure_ms: 8 gamma: 0.6 diff --git a/src/device/camera.cpp b/src/device/camera.cpp index 71de154..e147b6a 100644 --- a/src/device/camera.cpp +++ b/src/device/camera.cpp @@ -29,11 +29,16 @@ Camera::Camera(const std::string & config_path) else { throw std::runtime_error("Unknow camera_name: " + camera_name + "!"); } + + rotate_180_ = yaml["rotate_180"] ? yaml["rotate_180"].as() : false; } void Camera::read(cv::Mat & img, std::chrono::steady_clock::time_point & timestamp) { camera_->read(img, timestamp); + if (rotate_180_) { + cv::rotate(img, img, cv::ROTATE_180); + } } } // namespace device \ No newline at end of file diff --git a/src/device/camera.hpp b/src/device/camera.hpp index e0bb37b..a7205dc 100644 --- a/src/device/camera.hpp +++ b/src/device/camera.hpp @@ -23,6 +23,7 @@ public: private: std::unique_ptr camera_; + bool rotate_180_ = false; }; } // namespace device