5 #ifndef LIBREALSENSE_ZR300_H 6 #define LIBREALSENSE_ZR300_H 43 return sizeof(kf) +
sizeof(distf);
53 return{ 640, 480, kf[2], kf[5], kf[0], kf[4],
RS_DISTORTION_FTHETA, { distf[0], 0, 0, 0, 0 } };
64 return{ { rotation[0], rotation[1], rotation[2],
65 rotation[3], rotation[4], rotation[5],
66 rotation[6], rotation[7], rotation[8] },
67 { translation[0], translation[1], translation[2] } };
72 return sizeof(rotation) +
sizeof(translation);
91 return sizeof(fe_to_imu) +
sizeof(fe_to_depth) +
sizeof(rgb_to_imu) +
sizeof(depth_to_imu);
110 float acc_bias_variance[3];
111 float acc_noise_variance[3];
112 float gyro_bias_variance[3];
113 float gyro_noise_variance[3];
118 return sizeof(acc_intrinsic) +
sizeof(gyro_intrinsic) +
119 sizeof(acc_bias_variance) +
sizeof(acc_noise_variance) +
sizeof(gyro_bias_variance) +
sizeof(gyro_noise_variance);
131 for (
auto i = 0; i < 3; i++)
133 for (
auto j = 0; j < 4; j++)
135 res.
data[i][j] = intrin.
val[i][j];
139 for (
auto i = 0; i < 3; i++)
148 return convert(acc_intrinsic, acc_bias_variance, acc_noise_variance);
153 return convert(gyro_intrinsic, gyro_bias_variance, gyro_noise_variance);
158 return{ get_acc_intrinsic(), get_gyro_intrinsic() };
187 is_auto_exposure(true),
208 void modify_exposure(
float& exposure_value,
bool& exp_modified,
float& gain_value,
bool& gain_modified);
214 struct histogram_metric {
int under_exposure_count;
int over_exposure_count;
int shadow_limit;
int highlight_limit;
int lower_q;
int upper_q;
float main_mean;
float main_std; };
217 inline void im_hist(
const uint8_t*
data,
const int width,
const int height,
const int rowStep,
int h[]);
218 void increase_exposure_target(
float mult,
float& target_exposure);
219 void decrease_exposure_target(
float mult,
float& target_exposure);
220 void increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
221 void decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
222 void static_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
223 void static_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
224 void anti_flicker_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
225 void anti_flicker_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
226 void hybrid_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
227 void hybrid_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
229 #if defined(_WINDOWS) || defined(WIN32) || defined(WIN64) 230 inline float round(
float x) {
return std::round(x); }
232 inline float round(
float x) {
return x < 0.0 ? std::ceil(x - 0.5
f) : std::floor(x + 0.5
f); }
237 template <
typename T>
inline T
sqr(
const T& x) {
return (x*x); }
238 void histogram_score(std::vector<int>& h,
const int total_weight,
histogram_metric& score);
241 float minimal_exposure = 0.1f, maximal_exposure = 20.f, base_gain = 2.0f, gain_limit = 15.0f;
242 float exposure = 10.0f, gain = 2.0f, target_exposure = 0.0f;
243 uint8_t under_exposure_limit = 5, over_exposure_limit = 250;
int under_exposure_noise_limit = 50, over_exposure_noise_limit = 50;
244 int direction = 0, prev_direction = 0;
float hysteresis = 0.075f;
245 float eps = 0.01f, exposure_step = 0.1f, minimal_exposure_step = 0.01f;
254 void add_frame(
rs_frame_ref* frame, std::shared_ptr<rsimpl::frame_archive> archive);
266 size_t get_queue_size();
270 bool try_get_exp_by_frame_cnt(
double& exposure,
const unsigned long long frame_counter);
272 const std::size_t max_size_of_exp_and_cnt_queue = 10;
277 std::condition_variable
cv;
296 void toggle_motion_module_power(
bool bOn);
297 void toggle_motion_module_events(
bool bOn);
298 void on_before_callback(
rs_stream ,
rs_frame_ref *, std::shared_ptr<rsimpl::frame_archive>)
override;
306 void get_option_range(
rs_option option,
double & min,
double & max,
double & step,
double & def)
override;
312 void start_motion_tracking()
override;
313 void stop_motion_tracking()
override;
318 rs_stream select_key_stream(
const std::vector<rsimpl::subdevice_mode_selection> & selected_modes)
override;
322 unsigned long long get_frame_counter_by_usb_cmd();
328 void set_fw_logger_option(
double value);
329 unsigned get_fw_logger_option();
331 bool validate_motion_extrinsics(
rs_stream)
const;
332 bool validate_motion_intrinsics()
const;
337 std::shared_ptr<rs_device>
make_zr300_device(std::shared_ptr<uvc::device> device);
exposure_and_frame_counter(double exposure, unsigned long long frame_counter)
fisheye_auto_exposure_state state
std::shared_ptr< rs_device > make_zr300_device(std::shared_ptr< uvc::device > device)
std::deque< rs_frame_ref * > data_queue
int get_data_size() const
std::mutex exp_and_cnt_queue_mtx
MM_intrinsics gyro_intrinsic
GLint GLint GLsizei GLsizei height
rs_blob_type
Proprietary formats for direct communication with device firmware.
struct rs_intrinsics rs_intrinsics
Video stream intrinsics.
std::recursive_mutex state_mutex
GLenum GLenum GLsizei void * image
unsigned get_skip_frames(const fisheye_auto_exposure_state &auto_exposure_state)
rs_motion_device_intrinsic get_gyro_intrinsic() const
Motion device intrinsics: scale, bias, and variances.
rs_option
Defines general configuration controls.
int get_data_size() const
GLfloat GLfloat GLfloat GLfloat h
std::condition_variable cv
struct rs_extrinsics rs_extrinsics
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
rs_motion_device_intrinsic convert(const MM_intrinsics &intrin, const float bias_variance[3], const float noises_variance[3]) const
std::shared_ptr< std::thread > exposure_thread
IMU_intrinsic imu_intrinsic
GLuint GLuint GLsizei count
std::shared_ptr< rsimpl::frame_archive > sync_archive
std::atomic< unsigned > frames_counter
Motion module intrinsics: includes accelerometer and gyroscope intrinsics structs of type rs_motion_d...
std::deque< exposure_and_frame_counter > exposure_and_frame_counter_queue
bool check_not_all_zeros(std::vector< byte > data)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
motion_module::mm_config motion_module_configuration
MM_intrinsics acc_intrinsic
auto_exposure_algorithm auto_exposure_algo
unsigned get_auto_exposure_state(rs_option option) const
IMU_extrinsic mm_extrinsic
GLsizei const GLfloat * value
rs_source
Source: allows you to choose between available hardware subdevices.
struct rs_motion_intrinsics rs_motion_intrinsics
Motion module intrinsics: includes accelerometer and gyroscope intrinsics structs of type rs_motion_d...
motion_module::motion_module_control motion_module_ctrl
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
unsigned long long frame_counter
GLenum GLsizei GLsizei GLint * values
exposure_and_frame_counter()
rs_stream
Streams are different types of data provided by RealSense devices.
GLint GLint GLsizei width
std::atomic< bool > keep_alive
GLsizei GLsizei GLchar * source
fisheye_auto_exposure_state()
std::atomic< unsigned > skip_frames
std::shared_ptr< auto_exposure_mechanism > auto_exposure
rs_motion_device_intrinsic get_acc_intrinsic() const
fisheye_intrinsic fe_intrinsic
std::atomic< bool > to_add_frames
motion_module_calibration fe_intrinsic
int get_data_size() const
int get_data_size() const
fisheye_auto_exposure_state auto_exposure_state
motion_module_calibration read_fisheye_intrinsic(uvc::device &device, std::timed_mutex &mutex)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
mm_extrinsic depth_to_imu
std::timed_mutex usbMutex