add 相机旋转

This commit is contained in:
Robofish 2026-03-14 00:57:28 +08:00
parent 425be3f373
commit c046635bb9
12 changed files with 16 additions and 0 deletions

View File

@ -52,6 +52,7 @@ second_tolerance: 100 # 远距离射击容差degree
judge_distance: 2 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2 exposure_ms: 2
gain: 16 gain: 16

View File

@ -5,6 +5,7 @@ pattern_type: chessboard # circles_grid | chessboard
R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1] R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1]
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 3 exposure_ms: 3
gain: 10.0 gain: 10.0

View File

@ -3,6 +3,7 @@
# gamma: 0.5 # gamma: 0.5
# vid_pid: "f622:d13a" # vid_pid: "f622:d13a"
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 3 exposure_ms: 3
gain: 10.0 gain: 10.0

View File

@ -52,6 +52,7 @@ second_tolerance: 2 # 远距离射击容差degree
judge_distance: 2 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2 exposure_ms: 2
gain: 16 gain: 16

View File

@ -30,6 +30,7 @@ usb_gamma: 160
usb_gain: 10 #0-96 usb_gain: 10 #0-96
#####-----工业相机参数-----##### #####-----工业相机参数-----#####
rotate_180: false
camera_name: "mindvision" camera_name: "mindvision"
exposure_ms: 2 exposure_ms: 2
gamma: 0.5 gamma: 0.5

View File

@ -37,6 +37,7 @@ usb_gamma: 160
usb_gain: 10 #0-96 usb_gain: 10 #0-96
#####-----工业相机参数-----##### #####-----工业相机参数-----#####
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2 exposure_ms: 2
gain: 16 gain: 16

View File

@ -51,6 +51,7 @@ second_tolerance: 2 # 远距离射击容差degree
judge_distance: 2 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2.5 exposure_ms: 2.5
gain: 16.9 gain: 16.9

View File

@ -51,6 +51,7 @@ second_tolerance: 2 # 远距离射击容差degree
judge_distance: 2 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2.5 exposure_ms: 2.5
gain: 16.9 gain: 16.9

View File

@ -52,6 +52,7 @@ second_tolerance: 2 # 远距离射击容差degree
judge_distance: 2 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
rotate_180: false
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 2 exposure_ms: 2
gain: 16 gain: 16

View File

@ -22,6 +22,7 @@ roi:
use_roi: false use_roi: false
#####-----工业相机参数-----##### #####-----工业相机参数-----#####
rotate_180: false
camera_name: "mindvision" camera_name: "mindvision"
exposure_ms: 8 exposure_ms: 8
gamma: 0.6 gamma: 0.6

View File

@ -29,11 +29,16 @@ Camera::Camera(const std::string & config_path)
else { else {
throw std::runtime_error("Unknow camera_name: " + camera_name + "!"); throw std::runtime_error("Unknow camera_name: " + camera_name + "!");
} }
rotate_180_ = yaml["rotate_180"] ? yaml["rotate_180"].as<bool>() : false;
} }
void Camera::read(cv::Mat & img, std::chrono::steady_clock::time_point & timestamp) void Camera::read(cv::Mat & img, std::chrono::steady_clock::time_point & timestamp)
{ {
camera_->read(img, timestamp); camera_->read(img, timestamp);
if (rotate_180_) {
cv::rotate(img, img, cv::ROTATE_180);
}
} }
} // namespace device } // namespace device

View File

@ -23,6 +23,7 @@ public:
private: private:
std::unique_ptr<CameraBase> camera_; std::unique_ptr<CameraBase> camera_;
bool rotate_180_ = false;
}; };
} // namespace device } // namespace device