d400-auto-calibration.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
7 #include "../../core/advanced_mode.h"
8 
9 
10 namespace librealsense
11 {
12 #pragma pack(push, 1)
13 #pragma pack(1)
15  {
16  uint16_t status; // DscStatus
18  uint16_t stepSize; // 1/1000 of a pixel
19  uint32_t pixelCountThreshold; // minimum number of pixels in
20  // selected bin
21  uint16_t minDepth; // Depth range for FWHM
23  uint32_t rightPy; // 1/1000000 of normalized unit
24  float healthCheck;
25  float rightRotation[9]; // Right rotation
26  };
27 #pragma pack(pop)
28 
30  {
31  enum class auto_calib_action
32  {
33  RS2_OCC_ACTION_ON_CHIP_CALIB, // On-Chip calibration
34  RS2_OCC_ACTION_TARE_CALIB // Tare calibration
35  };
36 
38  {
46  };
47 
48  public:
50  void write_calibration() const override;
51  std::vector<uint8_t> run_on_chip_calibration(int timeout_ms, std::string json, float* const health, rs2_update_progress_callback_sptr progress_callback) override;
52  std::vector<uint8_t> run_tare_calibration(int timeout_ms, float ground_truth_mm, std::string json, float* const health, rs2_update_progress_callback_sptr progress_callback) override;
53  std::vector<uint8_t> process_calibration_frame(int timeout_ms, const rs2_frame* f, float* const health, rs2_update_progress_callback_sptr progress_callback) override;
54  std::vector<uint8_t> get_calibration_table() const override;
55  void set_calibration_table(const std::vector<uint8_t>& calibration) override;
56  void reset_to_factory_calibration() const override;
57  std::vector<uint8_t> run_focal_length_calibration(rs2_frame_queue* left, rs2_frame_queue* right, float target_w, float target_h,
58  int adjust_both_sides, float* ratio, float* angle, rs2_update_progress_callback_sptr progress_callback) override;
59  std::vector<uint8_t> run_uv_map_calibration(rs2_frame_queue* left, rs2_frame_queue* color, rs2_frame_queue* depth, int py_px_only,
60  float* const health, int health_size, rs2_update_progress_callback_sptr progress_callback) override;
61  float calculate_target_z(rs2_frame_queue* queue1, rs2_frame_queue* queue2, rs2_frame_queue* queue3,
62  float target_width, float target_height, rs2_update_progress_callback_sptr progress_callback) override;
63  void set_hw_monitor_for_auto_calib(std::shared_ptr<hw_monitor> hwm);
64 
65  private:
66  std::vector<uint8_t> get_calibration_results(float* const health = nullptr) const;
67  std::vector<uint8_t> get_PyRxFL_calibration_results(float* const health = nullptr, float* health_fl = nullptr) const;
68  void handle_calibration_error(int status) const;
69  std::map<std::string, int> parse_json(std::string json);
70  std::shared_ptr< ds_advanced_mode_base> change_preset();
71  void check_params(int speed, int scan_parameter, int data_sampling) const;
72  void check_tare_params(int speed, int scan_parameter, int data_sampling, int average_step_count, int step_count, int accuracy);
73  void check_focal_length_params(int step_count, int fy_scan_range, int keep_new_value_after_sucessful_scan, int interrrupt_data_samling, int adjust_both_sides, int fl_scan_location, int fy_scan_direction, int white_wall_mode) const;
74  void check_one_button_params(int speed, int keep_new_value_after_sucessful_scan, int data_sampling, int adjust_both_sides, int fl_scan_location, int fy_scan_direction, int white_wall_mode) const;
76  void undistort(uint8_t* img, const rs2_intrinsics& intrin, int roi_ws, int roi_hs, int roi_we, int roi_he);
78  void restore_preset();
79  void find_z_at_corners(float left_x[4], float left_y[4], rs2_frame_queue* frames, float left_z[4]);
82  void fill_missing_data(uint16_t data[256], int size);
83  void remove_outliers(uint16_t data[256], int size);
84  void collect_depth_frame_sum(const rs2_frame* f);
85  DirectSearchCalibrationResult get_calibration_status(int timeout_ms, std::function<void(const int count)> progress_func, bool wait_for_final_results = true);
86 
87  std::vector<uint8_t> _curr_calibration;
88  std::shared_ptr<hw_monitor> _hw_monitor;
89 
90  bool _preset_change = false;
93 
109 
110  };
111 }
librealsense::auto_calibrated::get_target_rect_info
void get_target_rect_info(rs2_frame_queue *frames, float rect_sides[4], float &fx, float &fy, int progress, rs2_update_progress_callback_sptr progress_callback)
Definition: d400-auto-calibration.cpp:1876
example1 - object detection.left
left
Definition: example1 - object detection.py:70
librealsense::auto_calibrated::undistort
void undistort(uint8_t *img, const rs2_intrinsics &intrin, int roi_ws, int roi_hs, int roi_we, int roi_he)
Definition: d400-auto-calibration.cpp:2061
rs2_update_progress_callback_sptr
std::shared_ptr< rs2_update_progress_callback > rs2_update_progress_callback_sptr
Definition: rs_types.hpp:97
color
GLuint color
Definition: glad/glad/glad.h:3181
librealsense::auto_calibrated::collect_depth_frame_sum
void collect_depth_frame_sum(const rs2_frame *f)
Definition: d400-auto-calibration.cpp:1207
librealsense
Definition: algo.h:18
intrin
rs2_intrinsics intrin
Definition: test-distortion.cpp:14
librealsense::DirectSearchCalibrationResult::stepCount
uint16_t stepCount
Definition: d400-auto-calibration.h:17
librealsense::auto_calibrated::check_one_button_params
void check_one_button_params(int speed, int keep_new_value_after_sucessful_scan, int data_sampling, int adjust_both_sides, int fl_scan_location, int fy_scan_direction, int white_wall_mode) const
Definition: d400-auto-calibration.cpp:1680
count
GLint GLsizei count
Definition: glad/glad/glad.h:2301
uint8_t
unsigned char uint8_t
Definition: stdint.h:78
librealsense::auto_calibrated::_hw_monitor
std::shared_ptr< hw_monitor > _hw_monitor
Definition: d400-auto-calibration.h:88
librealsense::device_serializer::status
status
Defines return codes that SDK interfaces use. Negative values indicate errors, a zero value indicates...
Definition: src/core/serialization.h:311
librealsense::auto_calibrated::_preset_change
bool _preset_change
Definition: d400-auto-calibration.h:90
rs2::stream_profile
Definition: rs_frame.hpp:22
test-projection-from-recording.frames
frames
Definition: test-projection-from-recording.py:30
uint16_t
unsigned short uint16_t
Definition: stdint.h:79
librealsense::auto_calibrated::_skipped_frames
int _skipped_frames
Definition: d400-auto-calibration.h:108
librealsense::auto_calibrated::run_on_chip_calibration
std::vector< uint8_t > run_on_chip_calibration(int timeout_ms, std::string json, float *const health, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:335
librealsense::auto_calibrated::find_z_at_corners
void find_z_at_corners(float left_x[4], float left_y[4], rs2_frame_queue *frames, float left_z[4])
Definition: d400-auto-calibration.cpp:2205
rs2_intrinsics
Video stream intrinsics.
Definition: rs_types.h:58
data
Definition: parser.hpp:153
rs2_frame
struct rs2_frame rs2_frame
Definition: rs_types.h:230
librealsense::DirectSearchCalibrationResult::pixelCountThreshold
uint32_t pixelCountThreshold
Definition: d400-auto-calibration.h:19
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
librealsense::auto_calibrated::run_tare_calibration
std::vector< uint8_t > run_tare_calibration(int timeout_ms, float ground_truth_mm, std::string json, float *const health, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:848
librealsense::auto_calibrated::_ground_truth_mm
float _ground_truth_mm
Definition: d400-auto-calibration.h:95
right
GLdouble right
Definition: glad/glad/glad.h:2249
librealsense::auto_calibrated::reset_to_factory_calibration
void reset_to_factory_calibration() const override
Definition: d400-auto-calibration.cpp:1870
realdds::topics::notification::dfu_apply::key::progress
const std::string progress
librealsense::DirectSearchCalibrationResult::stepSize
uint16_t stepSize
Definition: d400-auto-calibration.h:18
librealsense::auto_calibrated::_curr_calibration
std::vector< uint8_t > _curr_calibration
Definition: d400-auto-calibration.h:87
rs2_frame_queue
Definition: rs.cpp:195
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_NOT_ACTIVE
@ RS2_OCC_STATE_NOT_ACTIVE
librealsense::auto_calibrated::parse_json
std::map< std::string, int > parse_json(std::string json)
Definition: d400-auto-calibration.cpp:204
librealsense::auto_calibrated::change_preset_and_stay
void change_preset_and_stay()
Definition: d400-auto-calibration.cpp:1594
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_WAIT_FOR_FINAL_FW_CALL
@ RS2_OCC_STATE_WAIT_FOR_FINAL_FW_CALL
size
GLsizeiptr size
Definition: glad/glad/glad.h:2734
librealsense::auto_calibrated::_max_valid_depth
uint16_t _max_valid_depth
Definition: d400-auto-calibration.h:107
librealsense::json
rsutils::json json
Definition: json_loader.hpp:26
librealsense::auto_calibrated::process_calibration_frame
std::vector< uint8_t > process_calibration_frame(int timeout_ms, const rs2_frame *f, float *const health, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:1279
test-unit-transform.fx
fx
Definition: test-unit-transform.py:25
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_WAIT_TO_CALIB_START
@ RS2_OCC_STATE_WAIT_TO_CALIB_START
librealsense::auto_calibrated::get_calibration_status
DirectSearchCalibrationResult get_calibration_status(int timeout_ms, std::function< void(const int count)> progress_func, bool wait_for_final_results=true)
Definition: d400-auto-calibration.cpp:277
uint32_t
unsigned int uint32_t
Definition: stdint.h:80
librealsense::auto_calibrated::check_params
void check_params(int speed, int scan_parameter, int data_sampling) const
Definition: d400-auto-calibration.cpp:1626
f
GLdouble f
Definition: glad/glad/glad.h:1517
librealsense::auto_calibrated::_resize_factor
int _resize_factor
Definition: d400-auto-calibration.h:101
librealsense::scan_parameter
scan_parameter
Definition: d400-auto-calibration.cpp:136
depth_auto_calibration_example.progress_callback
def progress_callback(progress)
Definition: depth_auto_calibration_example.py:96
rs2_metadata_type
long long rs2_metadata_type
Definition: rs_types.h:272
librealsense::data_sampling
data_sampling
Definition: d400-auto-calibration.cpp:130
librealsense::auto_calibrated::check_tare_params
void check_tare_params(int speed, int scan_parameter, int data_sampling, int average_step_count, int step_count, int accuracy)
Definition: d400-auto-calibration.cpp:1642
angle
cv::RotateFlags angle(cv::RotateFlags::ROTATE_90_CLOCKWISE)
librealsense::DirectSearchCalibrationResult::healthCheck
float healthCheck
Definition: d400-auto-calibration.h:24
librealsense::DirectSearchCalibrationResult::minDepth
uint16_t minDepth
Definition: d400-auto-calibration.h:21
librealsense::auto_calibrated::get_target_dots_info
void get_target_dots_info(rs2_frame_queue *frames, float dots_x[4], float dots_y[4], rs2::stream_profile &profile, rs2_intrinsics &fy, int progress, rs2_update_progress_callback_sptr progress_callback)
Definition: d400-auto-calibration.cpp:2127
librealsense::auto_calibrated::_old_preset
rs2_rs400_visual_preset _old_preset
Definition: d400-auto-calibration.h:92
librealsense::auto_calibrated::_collected_frame_num
int _collected_frame_num
Definition: d400-auto-calibration.h:99
librealsense::auto_calibrated::write_calibration
void write_calibration() const override
Definition: d400-auto-calibration.cpp:1805
librealsense::auto_calibrated::calculate_target_z
float calculate_target_z(rs2_frame_queue *queue1, rs2_frame_queue *queue2, rs2_frame_queue *queue3, float target_width, float target_height, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:2479
librealsense::auto_calibrated::_collected_sum
double _collected_sum
Definition: d400-auto-calibration.h:100
librealsense::auto_calibrated::calc_fill_rate
uint16_t calc_fill_rate(const rs2_frame *f)
Definition: d400-auto-calibration.cpp:1055
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_DATA_COLLECT
@ RS2_OCC_STATE_DATA_COLLECT
librealsense::auto_calibrated::set_hw_monitor_for_auto_calib
void set_hw_monitor_for_auto_calib(std::shared_ptr< hw_monitor > hwm)
Definition: d400-auto-calibration.cpp:2570
librealsense::auto_calibrated::change_preset
std::shared_ptr< ds_advanced_mode_base > change_preset()
Definition: d400-auto-calibration.cpp:1566
librealsense::auto_calibrated::remove_outliers
void remove_outliers(uint16_t data[256], int size)
Definition: d400-auto-calibration.cpp:1158
librealsense::auto_calibrated::_json
std::string _json
Definition: d400-auto-calibration.h:94
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_WAIT_TO_CAMERA_START
@ RS2_OCC_STATE_WAIT_TO_CAMERA_START
librealsense::DirectSearchCalibrationResult
Definition: d400-auto-calibration.h:14
auto-calibrated-device.h
librealsense::auto_calibrated::auto_calib_action::RS2_OCC_ACTION_TARE_CALIB
@ RS2_OCC_ACTION_TARE_CALIB
librealsense::auto_calibrated::get_PyRxFL_calibration_results
std::vector< uint8_t > get_PyRxFL_calibration_results(float *const health=nullptr, float *health_fl=nullptr) const
Definition: d400-auto-calibration.cpp:1752
librealsense::auto_calibrated::auto_calib_action
auto_calib_action
Definition: d400-auto-calibration.h:31
rs2_rs400_visual_preset
rs2_rs400_visual_preset
For RS400 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:196
librealsense::auto_calibrated::_prev_frame_counter
rs2_metadata_type _prev_frame_counter
Definition: d400-auto-calibration.h:105
librealsense::auto_calibrated::fill_missing_data
void fill_missing_data(uint16_t data[256], int size)
Definition: d400-auto-calibration.cpp:1116
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_FINAL_FW_CALL
@ RS2_OCC_STATE_FINAL_FW_CALL
librealsense::auto_calibrated::_old_preset_values
preset _old_preset_values
Definition: d400-auto-calibration.h:91
librealsense::auto_calibrated::_average_step_count
int _average_step_count
Definition: d400-auto-calibration.h:97
librealsense::auto_calibrated::_collected_counter
int _collected_counter
Definition: d400-auto-calibration.h:98
librealsense::auto_calibrated::run_focal_length_calibration
std::vector< uint8_t > run_focal_length_calibration(rs2_frame_queue *left, rs2_frame_queue *right, float target_w, float target_h, int adjust_both_sides, float *ratio, float *angle, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:1933
librealsense::DirectSearchCalibrationResult::rightPy
uint32_t rightPy
Definition: d400-auto-calibration.h:23
librealsense::auto_calibrated::_action
auto_calib_action _action
Definition: d400-auto-calibration.h:102
librealsense::auto_calibrated::_fill_factor
uint16_t _fill_factor[256]
Definition: d400-auto-calibration.h:106
librealsense::auto_calibrated::auto_calib_action::RS2_OCC_ACTION_ON_CHIP_CALIB
@ RS2_OCC_ACTION_ON_CHIP_CALIB
librealsense::preset
Definition: presets.h:99
librealsense::auto_calibrated::get_calibration_results
std::vector< uint8_t > get_calibration_results(float *const health=nullptr) const
Definition: d400-auto-calibration.cpp:1725
librealsense::DirectSearchCalibrationResult::rightRotation
float rightRotation[9]
Definition: d400-auto-calibration.h:25
img
GLint void * img
Definition: glad/glad/glad.h:2435
librealsense::auto_calibrated::restore_preset
void restore_preset()
Definition: d400-auto-calibration.cpp:1607
librealsense::auto_calibrated::_interactive_scan
bool _interactive_scan
Definition: d400-auto-calibration.h:104
librealsense::auto_calibrated
Definition: d400-auto-calibration.h:29
librealsense::auto_calibrated::run_uv_map_calibration
std::vector< uint8_t > run_uv_map_calibration(rs2_frame_queue *left, rs2_frame_queue *color, rs2_frame_queue *depth, int py_px_only, float *const health, int health_size, rs2_update_progress_callback_sptr progress_callback) override
Definition: d400-auto-calibration.cpp:2298
librealsense::auto_calibrated::_interactive_state
interactive_calibration_state _interactive_state
Definition: d400-auto-calibration.h:103
librealsense::auto_calibrated::check_focal_length_params
void check_focal_length_params(int step_count, int fy_scan_range, int keep_new_value_after_sucessful_scan, int interrrupt_data_samling, int adjust_both_sides, int fl_scan_location, int fy_scan_direction, int white_wall_mode) const
Definition: d400-auto-calibration.cpp:1660
librealsense::DirectSearchCalibrationResult::maxDepth
uint16_t maxDepth
Definition: d400-auto-calibration.h:22
librealsense::auto_calibrated::interactive_calibration_state::RS2_OCC_STATE_INITIAL_FW_CALL
@ RS2_OCC_STATE_INITIAL_FW_CALL
librealsense::DirectSearchCalibrationResult::status
uint16_t status
Definition: d400-auto-calibration.h:16
librealsense::auto_calibrated::handle_calibration_error
void handle_calibration_error(int status) const
Definition: d400-auto-calibration.cpp:1698
librealsense::auto_calibrated::_total_frames
int _total_frames
Definition: d400-auto-calibration.h:96
librealsense::auto_calibrated::auto_calibrated
auto_calibrated()
Definition: d400-auto-calibration.cpp:190
librealsense::auto_calibrated::get_calibration_table
std::vector< uint8_t > get_calibration_table() const override
Definition: d400-auto-calibration.cpp:1781
librealsense::auto_calibrated_interface
Definition: auto-calibrated-device.h:12
profile
Definition: unit-tests-common.h:58
test-unit-transform.fy
fy
Definition: test-unit-transform.py:26
depth
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glad/glad/glad.h:2398
librealsense::auto_calibrated::_min_valid_depth
uint16_t _min_valid_depth
Definition: d400-auto-calibration.h:107
librealsense::auto_calibrated::set_calibration_table
void set_calibration_table(const std::vector< uint8_t > &calibration) override
Definition: d400-auto-calibration.cpp:1837
librealsense::auto_calibrated::interactive_calibration_state
interactive_calibration_state
Definition: d400-auto-calibration.h:37


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01