Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Public Member Functions | List of all members
rs2::auto_calibrated_device Class Reference

#include <rs_device.hpp>

Inheritance diagram for rs2::auto_calibrated_device:
rs2::calibrated_device rs2::device

Public Member Functions

 auto_calibrated_device (device d)
 
template<class T >
calibration_table run_on_chip_calibration (std::string json_content, float *health, T callback, int timeout_ms=5000) const
 
calibration_table run_on_chip_calibration (std::string json_content, float *health, int timeout_ms=5000) const
 
template<class T >
calibration_table run_tare_calibration (float ground_truth_mm, std::string json_content, float *health, T callback, int timeout_ms=5000) const
 
calibration_table run_tare_calibration (float ground_truth_mm, std::string json_content, float *health, int timeout_ms=5000) const
 
template<class T >
calibration_table process_calibration_frame (rs2::frame f, float *const health, T callback, int timeout_ms=5000) const
 
calibration_table process_calibration_frame (rs2::frame f, float *const health, int timeout_ms=5000) const
 
calibration_table get_calibration_table ()
 
void set_calibration_table (const calibration_table &calibration)
 
rs2_calibration_config json_string_to_calibration_config (const std::string &json_str) const
 
std::string calibration_config_to_json_string (const rs2_calibration_config &calib_config) const
 
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) const
 
template<class T >
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, T callback) const
 
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 *health, int health_size) const
 
template<class T >
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 *health, int health_size, T callback) const
 
float calculate_target_z (rs2::frame_queue queue1, rs2::frame_queue queue2, rs2::frame_queue queue3, float target_width, float target_height) const
 
template<class T >
float calculate_target_z (rs2::frame_queue queue1, rs2::frame_queue queue2, rs2::frame_queue queue3, float target_width, float target_height, T callback) const
 
rs2_calibration_config get_calibration_config () const
 
void set_calibration_config (const rs2_calibration_config &calib_config)
 
- Public Member Functions inherited from rs2::calibrated_device
 calibrated_device (device d)
 
void write_calibration () const
 
void reset_to_factory_calibration ()
 
- Public Member Functions inherited from rs2::device
std::vector< sensorquery_sensors () const
 
std::string get_type () const
 
std::string get_description () const
 
template<class T >
first () const
 
bool supports (rs2_camera_info info) const
 
const char * get_info (rs2_camera_info info) const
 
void hardware_reset ()
 
deviceoperator= (const std::shared_ptr< rs2_device > dev)
 
deviceoperator= (const device &dev)
 
 device ()
 
 operator bool () const
 
const std::shared_ptr< rs2_device > & get () const
 
bool operator< (device const &other) const
 
bool is_connected () const
 
template<class T >
bool is () const
 
template<class T >
as () const
 
virtual ~device ()
 
 operator std::shared_ptr< rs2_device > ()
 
 device (std::shared_ptr< rs2_device > dev)
 

Additional Inherited Members

- Protected Attributes inherited from rs2::device
std::shared_ptr< rs2_device_dev
 

Constructor & Destructor Documentation

◆ auto_calibrated_device()

rs2::auto_calibrated_device::auto_calibrated_device ( device  d)
inline

Member Function Documentation

◆ calculate_target_z() [1/2]

float rs2::auto_calibrated_device::calculate_target_z ( rs2::frame_queue  queue1,
rs2::frame_queue  queue2,
rs2::frame_queue  queue3,
float  target_width,
float  target_height 
) const
inline

Calculate Z for calibration target - distance to the target's plane

Parameters
[in]queue1-3Frame queues of raw images used to calculate and extract the distance to a predefined target pattern. For D400 the indexes 1-3 correspond to Left IR, Right IR and Depth with only the Left IR being used
[in]target_widthexpected target's horizontal dimension in mm
[in]target_heightexpected target's vertical dimension in mm
Returns
Calculated distance (Z) to target in millimeter, return negative number on failure

◆ calculate_target_z() [2/2]

template<class T >
float rs2::auto_calibrated_device::calculate_target_z ( rs2::frame_queue  queue1,
rs2::frame_queue  queue2,
rs2::frame_queue  queue3,
float  target_width,
float  target_height,
callback 
) const
inline

Calculate Z for calibration target - distance to the target's plane

Parameters
[in]queue1-3Frame queues of raw images used to calculate and extract the distance to a predefined target pattern. For D400 the indexes 1-3 correspond to Left IR, Right IR and Depth with only the Left IR being used
[in]target_widthexpected target's horizontal dimension in mm
[in]target_heightexpected target's vertical dimension in mm
[in]callbackOptional callback for reporting progress status
Returns
Calculated distance (Z) to target in millimeter, return negative number on failure

◆ calibration_config_to_json_string()

std::string rs2::auto_calibrated_device::calibration_config_to_json_string ( const rs2_calibration_config calib_config) const
inline

calibration_config_to_json_string

Parameters
[in]calib_configCalibration config struct to convert to JSON string
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
calib_config Calibration Configuration struct to be filled

◆ get_calibration_config()

rs2_calibration_config rs2::auto_calibrated_device::get_calibration_config ( ) const
inline

get_calibration_config

Parameters
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
calib_config Calibration Configuration struct to be filled

◆ get_calibration_table()

calibration_table rs2::auto_calibrated_device::get_calibration_table ( )
inline

Read current calibration table from flash.

Returns
Calibration table

◆ json_string_to_calibration_config()

rs2_calibration_config rs2::auto_calibrated_device::json_string_to_calibration_config ( const std::string &  json_str) const
inline

json_string_to_calibration_config

Parameters
[in]json_strJSON string to convert to calibration config struct
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
calib_config Calibration Configuration struct to be filled

◆ process_calibration_frame() [1/2]

template<class T >
calibration_table rs2::auto_calibrated_device::process_calibration_frame ( rs2::frame  f,
float *const  health,
callback,
int  timeout_ms = 5000 
) const
inline

When doing a host-assited calibration (Tare or on-chip) add frame to the calibration process

Parameters
[in]fThe next depth frame.
[in]callbackOptional callback to get progress notifications
[in]timeout_msTimeout in ms
[out]healthThe health check numbers before and after calibration
Returns
a New calibration table when process is done. An empty table otherwise - need more frames.

◆ process_calibration_frame() [2/2]

calibration_table rs2::auto_calibrated_device::process_calibration_frame ( rs2::frame  f,
float *const  health,
int  timeout_ms = 5000 
) const
inline

When doing a host-assited calibration (Tare or on-chip) add frame to the calibration process

Parameters
[in]fThe next depth frame.
[in]timeout_msTimeout in ms
[out]healthThe health check numbers before and after calibration
Returns
a New calibration table when process is done. An empty table otherwise - need more frames.

◆ run_focal_length_calibration() [1/2]

std::vector<uint8_t> rs2::auto_calibrated_device::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 
) const
inline

Run target-based focal length calibration for D400 Stereo Cameras

Parameters
[in]left_queuecontainer for left IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI.
[in]right_queuecontainer for right IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]target_wthe rectangle width in mm on the target
[in]target_hthe rectangle height in mm on the target
[in]adjust_both_sides1 for adjusting both left and right camera calibration tables and 0 for adjusting right camera calibraion table only
[out]ratiothe corrected ratio from the calibration
[out]anglethe target's tilt angle
Returns
New calibration table

◆ run_focal_length_calibration() [2/2]

template<class T >
std::vector<uint8_t> rs2::auto_calibrated_device::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,
callback 
) const
inline

Run target-based focal length calibration for D400 Stereo Cameras

Parameters
[in]left_queuecontainer for left IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI.
[in]right_queuecontainer for right IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]target_wthe rectangle width in mm on the target
[in]target_hthe rectangle height in mm on the target
[in]adjust_both_sides1 for adjusting both left and right camera calibration tables and 0 for adjusting right camera calibraion table only
[out]ratiothe corrected ratio from the calibration
[out]anglethe target's tilt angle
Returns
New calibration table

◆ run_on_chip_calibration() [1/2]

template<class T >
calibration_table rs2::auto_calibrated_device::run_on_chip_calibration ( std::string  json_content,
float *  health,
callback,
int  timeout_ms = 5000 
) const
inline

On-chip calibration intended to reduce the Depth noise. Applies to D400 Depth cameras

Parameters
[in]json_contentJson string to configure regular speed on chip calibration parameters: { "calib type" : 0, "speed": 3, "scan parameter": 0, "adjust both sides": 0, "white wall mode": 0, "host assistance": 0 } calib_type - calibraton type: 0 = regular, 1 = focal length, 2 = both regular and focal length in order speed - for regular calibration. value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow for type 0 and Fast for type 2 scan_parameter - for regular calibration. value can be one of: Py scan (default) = 0, Rx scan = 1 adjust_both_sides - for focal length calibration. value can be one of: 0 = adjust right only, 1 = adjust both sides white_wall_mode - white wall mode: 0 for normal mode and 1 for white wall mode host_assistance: 0 for no assistance, 1 for starting with assistance, 2 for first part feeding host data to firmware, 3 for second part of feeding host data to firmware (calib_type 2 only) if json is nullptr it will be ignored and calibration will use the default parameters
[out]healthThe absolute value of regular calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.25) - Good [0.25, 0.75) - Can be Improved [0.75, ) - Requires Calibration The absolute value of focal length calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.15) - Good [0.15, 0.75) - Can be Improved [0.75, ) - Requires Calibration The two health numbers are encoded in one integer as follows for calib_type 2: Regular health number times 1000 are bits 0 to 11 Regular health number is negative if bit 24 is 1 Focal length health number times 1000 are bits 12 to 23 Focal length health number is negative if bit 25 is 1
[in]callbackOptional callback to get progress notifications
[in]timeout_msTimeout in ms
Returns
New calibration table

◆ run_on_chip_calibration() [2/2]

calibration_table rs2::auto_calibrated_device::run_on_chip_calibration ( std::string  json_content,
float *  health,
int  timeout_ms = 5000 
) const
inline

On-chip calibration intended to reduce the Depth noise. Applies to D400 Depth cameras

Parameters
[in]json_contentJson string to configure regular speed on chip calibration parameters: { "focal length" : 0, "speed": 3, "scan parameter": 0, "adjust both sides": 0, "white wall mode": 0, "host assistance": 0 } focal_length - calibraton type: 0 = regular, 1 = focal length, 2 = both regular and focal length in order speed - for regular calibration. value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow for type 0 and Fast for type 2 scan_parameter - for regular calibration. value can be one of: Py scan (default) = 0, Rx scan = 1 adjust_both_sides - for focal length calibration. value can be one of: 0 = adjust right only, 1 = adjust both sides white_wall_mode - white wall mode: 0 for normal mode and 1 for white wall mode host_assistance: 0 for no assistance, 1 for starting with assistance, 2 for first part feeding host data to firmware, 3 for second part of feeding host data to firmware (calib_type 2 only) if json is nullptr it will be ignored and calibration will use the default parameters
[out]healthThe absolute value of regular calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.25) - Good [0.25, 0.75) - Can be Improved [0.75, ) - Requires Calibration The absolute value of focal length calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.15) - Good [0.15, 0.75) - Can be Improved [0.75, ) - Requires Calibration The two health numbers are encoded in one integer as follows for calib_type 2: Regular health number times 1000 are bits 0 to 11 Regular health number is negative if bit 24 is 1 Focal length health number times 1000 are bits 12 to 23 Focal length health number is negative if bit 25 is 1
[in]timeout_msTimeout in ms
Returns
New calibration table

◆ run_tare_calibration() [1/2]

template<class T >
calibration_table rs2::auto_calibrated_device::run_tare_calibration ( float  ground_truth_mm,
std::string  json_content,
float *  health,
callback,
int  timeout_ms = 5000 
) const
inline

Tare calibration adjusts the camera absolute distance to flat target. Applies to D400 Depth cameras User needs to enter the known ground truth.

Parameters
[in]ground_truth_mmGround truth in mm must be between 60 and 10000
[in]json_contentJson string to configure tare calibration parameters: { "average step count": 20, "step count": 20, "accuracy": 2, "scan parameter": 0, "data sampling": 0, "host assistance": 0, "depth" : 0 } average step count - number of frames to average, must be between 1 - 30, default = 20 step count - max iteration steps, must be between 5 - 30, default = 10 accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is Medium scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1 data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1 host_assistance: 0 for no assistance, 1 for starting with assistance, 2 for feeding host data to firmware depth: 0 for not relating to depth, > 0 for feeding depth from host to firmware, -1 for ending to feed depth from host to firmware if json is nullptr it will be ignored and calibration will use the default parameters
[in]content_sizeJson string size if its 0 the json will be ignored and calibration will use the default parameters
[out]healthThe absolute value of regular calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.25) - Good [0.25, 0.75) - Can be Improved [0.75, ) - Requires Calibration
[in]callbackOptional callback to get progress notifications
[in]timeout_msTimeout in ms
Returns
New calibration table

◆ run_tare_calibration() [2/2]

calibration_table rs2::auto_calibrated_device::run_tare_calibration ( float  ground_truth_mm,
std::string  json_content,
float *  health,
int  timeout_ms = 5000 
) const
inline

Tare calibration adjusts the camera absolute distance to flat target. Applies to D400 Depth cameras User needs to enter the known ground truth.

Parameters
[in]ground_truth_mmGround truth in mm must be between 60 and 10000
[in]json_contentJson string to configure tare calibration parameters: { "average step count": 20, "step count": 20, "accuracy": 2, "scan parameter": 0, "data sampling": 0, "host assistance": 0, "depth" : 0 } average step count - number of frames to average, must be between 1 - 30, default = 20 step count - max iteration steps, must be between 5 - 30, default = 10 accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is Medium scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1 data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1 host_assistance: 0 for no assistance, 1 for starting with assistance, 2 for feeding host data to firmware depth: 0 for not relating to depth, > 0 for feeding depth from host to firmware, -1 for ending to feed depth from host to firmware if json is nullptr it will be ignored and calibration will use the default parameters
[in]content_sizeJson string size if its 0 the json will be ignored and calibration will use the default parameters
[out]healthThe absolute value of regular calibration Health-Check captures how far camera calibration is from the optimal one [0, 0.25) - Good [0.25, 0.75) - Can be Improved [0.75, ) - Requires Calibration
[in]timeout_msTimeout in ms
Returns
New calibration table

◆ run_uv_map_calibration() [1/2]

std::vector<uint8_t> rs2::auto_calibrated_device::run_uv_map_calibration ( rs2::frame_queue  left,
rs2::frame_queue  color,
rs2::frame_queue  depth,
int  py_px_only,
float *  health,
int  health_size 
) const
inline

Depth-RGB UV-Map calibration. Applicable for D400 cameras

Parameters
[in]leftcontainer for left IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI.
[in]colorcontainer for RGB frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]depthcontainer for Depth frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]py_px_only1 for calibrating color camera py and px only, 1 for calibrating color camera py, px, fy, and fx.
[out]healthThe four health check numbers int the oorder of px, py, fx, fy for the calibration
[in]health_sizenumber of health check numbers, which is 4 by default
[in]callbackOptional callback for update progress notifications, the progress value is normailzed to 1
Returns
New calibration table

◆ run_uv_map_calibration() [2/2]

template<class T >
std::vector<uint8_t> rs2::auto_calibrated_device::run_uv_map_calibration ( rs2::frame_queue  left,
rs2::frame_queue  color,
rs2::frame_queue  depth,
int  py_px_only,
float *  health,
int  health_size,
callback 
) const
inline

Depth-RGB UV-Map calibration. Applicable for D400 cameras

Parameters
[in]leftcontainer for left IR frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI.
[in]colorcontainer for RGB frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]depthcontainer for Depth frames with resoluton of 1280x720 and the target in the center of 320x240 pixels ROI
[in]py_px_only1 for calibrating color camera py and px only, 1 for calibrating color camera py, px, fy, and fx.
[out]healthThe four health check numbers in order of px, py, fx, fy for the calibration
[in]health_sizenumber of health check numbers, which is 4 by default
[in]callbackOptional callback for update progress notifications, the progress value is normailzed to 1
[in]client_dataOptional client data for the callback
Returns
New calibration table

◆ set_calibration_config()

void rs2::auto_calibrated_device::set_calibration_config ( const rs2_calibration_config calib_config)
inline

set_calibration_config

Parameters
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
calib_config Calibration Configuration struct to be filled

◆ set_calibration_table()

void rs2::auto_calibrated_device::set_calibration_table ( const calibration_table calibration)
inline

Set current table to dynamic area.

Parameters
[in]Calibrationtable

The documentation for this class was generated from the following file: