Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
|
Go to the documentation of this file.
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 } };
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++)
187 is_auto_exposure(true),
198 bool is_auto_exposure;
201 unsigned sample_rate;
202 unsigned skip_frames;
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; };
215 enum class rounding_mode_type { round, ceil, floor };
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.5f) : std::floor(x + 0.5f); }
235 float exposure_to_value(
float exp_ms, rounding_mode_type rounding_mode);
236 float gain_to_value(
float gain, rounding_mode_type rounding_mode);
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;
247 std::recursive_mutex state_mutex;
266 size_t get_queue_size();
269 void push_back_exp_and_cnt(exposure_and_frame_counter exp_and_cnt);
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;
275 std::shared_ptr<rsimpl::frame_archive> sync_archive;
276 std::shared_ptr<std::thread> exposure_thread;
277 std::condition_variable cv;
278 std::atomic<bool> keep_alive;
279 std::deque<rs_frame_ref*> data_queue;
280 std::mutex queue_mtx;
281 std::atomic<unsigned> frames_counter;
282 std::atomic<unsigned> skip_frames;
283 std::deque<exposure_and_frame_counter> exposure_and_frame_counter_queue;
284 std::mutex exp_and_cnt_queue_mtx;
292 std::shared_ptr<auto_exposure_mechanism> auto_exposure;
293 std::atomic<bool> to_add_frames;
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);
struct rs_extrinsics rs_extrinsics
Cross-stream extrinsics: encode the topology describing how the different devices are connected.
bool has_data() const
Definition: zr300.h:122
@ RS_DISTORTION_FTHETA
Definition: rs.h:104
float data[3][4]
Definition: rs.h:318
float bias_variances[3]
Definition: rs.h:321
byte DS4_s_n[6]
Definition: zr300.h:30
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
Definition: motion-module.h:176
IMU_version ver
Definition: zr300.h:107
bool has_data() const
Definition: zr300.h:75
float noise_variances[3]
Definition: rs.h:320
void toggle_motion_module_power(bool bOn)
unsigned long long get_frame_counter_by_usb_cmd()
byte CRC32[4]
Definition: zr300.h:23
exposure_and_frame_counter(double exposure, unsigned long long frame_counter)
Definition: zr300.h:258
IMU_intrinsic imu_intrinsic
Definition: zr300.h:166
float kf[9]
Definition: zr300.h:37
void update_auto_exposure_state(fisheye_auto_exposure_state &auto_exposure_state)
void stop_motion_tracking() override
void set_auto_exposure_state(rs_option option, double value)
struct rs_motion_intrinsics rs_motion_intrinsics
Motion module intrinsics: includes accelerometer and gyroscope intrinsics structs of type rs_motion_d...
void add_frame(rs_frame_ref *frame, std::shared_ptr< rsimpl::frame_archive > archive)
void get_options(const rs_option options[], size_t count, double values[]) override
void set_options(const rs_option options[], size_t count, const double values[]) override
rs_motion_device_intrinsic get_gyro_intrinsic() const
Definition: zr300.h:151
byte ver[4]
Definition: zr300.h:21
float rotation[9]
Definition: zr300.h:60
fisheye_auto_exposure_state()
Definition: zr300.h:186
Motion module intrinsics: includes accelerometer and gyroscope intrinsics structs of type rs_motion_d...
Definition: rs.h:325
MM_intrinsics acc_intrinsic
Definition: zr300.h:108
exposure_and_frame_counter()
Definition: zr300.h:257
IMU_version ver
Definition: zr300.h:28
MM_intrinsics gyro_intrinsic
Definition: zr300.h:109
IMU_version ver
Definition: zr300.h:36
rs_motion_device_intrinsic get_acc_intrinsic() const
Definition: zr300.h:146
IMU_version ver
Definition: zr300.h:82
void update_options(const fisheye_auto_exposure_state &options)
mm_extrinsic depth_to_imu
Definition: zr300.h:86
rs_stream select_key_stream(const std::vector< rsimpl::subdevice_mode_selection > &selected_modes) override
float gyro_noise_variance[3]
Definition: zr300.h:113
int get_data_size() const
Definition: zr300.h:70
calibration calib
Definition: zr300.h:171
source
Allows the user to choose between available hardware subdevices.
Definition: rs.hpp:219
bool check_not_all_zeros(std::vector< byte > data)
Definition: types.h:643
byte reserved[55]
Definition: zr300.h:87
void on_before_callback(rs_stream, rs_frame_ref *, std::shared_ptr< rsimpl::frame_archive >) override
int get_data_size() const
Definition: zr300.h:89
bool analyze_image(const rs_frame_ref *image)
void toggle_motion_module_events(bool bOn)
byte reserved[235]
Definition: zr300.h:31
Motion device intrinsics: scale, bias, and variances.
Definition: rs.h:313
float acc_noise_variance[3]
Definition: zr300.h:111
serial_number sn
Definition: zr300.h:170
float acc_bias_variance[3]
Definition: zr300.h:110
void stop(rs_source source) override
double exposure
Definition: zr300.h:259
byte size
Definition: zr300.h:22
Cross-stream extrinsics: encode the topology describing how the different devices are connected.
Definition: rs.h:332
auto_exposure_modes
Definition: zr300.h:177
@ auto_exposure_anti_flicker
struct rs_intrinsics rs_intrinsics
Video stream intrinsics.
int get_data_size() const
Definition: zr300.h:41
byte MM_s_n[6]
Definition: zr300.h:29
rs_source
Source: allows you to choose between available hardware subdevices.
Definition: rs.h:90
void send_blob_to_device(rs_blob_type type, void *data, int size) override
option
Defines general configuration controls.
Definition: rs.hpp:87
~auto_exposure_mechanism()
@ RS_OPTION_FISHEYE_AUTO_EXPOSURE_SKIP_FRAMES
Definition: rs.h:194
void start_motion_tracking() override
Definition: motion-module.h:87
rs_blob_type
Proprietary formats for direct communication with device firmware.
Definition: rs.h:228
mm_extrinsic fe_to_depth
Definition: zr300.h:84
zr300_camera(std::shared_ptr< uvc::device > device, const static_device_info &info, motion_module_calibration fe_intrinsic, calibration_validator validator)
rs_option
Defines general configuration controls.
Definition: rs.h:128
byte reserved[191]
Definition: zr300.h:39
float val[3][4]
Definition: zr300.h:101
std::shared_ptr< rs_device > make_zr300_device(std::shared_ptr< uvc::device > device)
auto_exposure_mechanism(zr300_camera *dev, fisheye_auto_exposure_state auto_exposure_state)
Definition: ds-device.h:30
void get_option_range(rs_option option, double &min, double &max, double &step, double &def) override
void modify_exposure(float &exposure_value, bool &exp_modified, float &gain_value, bool &gain_modified)
float distf[5]
Definition: zr300.h:38
motion_module_calibration read_fisheye_intrinsic(uvc::device &device)
float translation[3]
Definition: zr300.h:61
Definition: rscore.hpp:44
byte reserved[103]
Definition: zr300.h:114
IMU_extrinsic mm_extrinsic
Definition: zr300.h:165
int get_data_size() const
Definition: zr300.h:116
rs_motion_intrinsics get_motion_intrinsics() const override
mm_extrinsic rgb_to_imu
Definition: zr300.h:85
unsigned long long frame_counter
Definition: zr300.h:260
auto_exposure_algorithm(fisheye_auto_exposure_state auto_exposure_state)
unsigned get_auto_exposure_state(rs_option option) const
mm_extrinsic fe_to_imu
Definition: zr300.h:83
rs_motion_device_intrinsic convert(const MM_intrinsics &intrin, const float bias_variance[3], const float noises_variance[3]) const
Definition: zr300.h:127
float gyro_bias_variance[3]
Definition: zr300.h:112
std::timed_mutex usbMutex
Definition: zr300.h:300
rs_extrinsics get_motion_extrinsics_from(rs_stream from) const override
fisheye_intrinsic fe_intrinsic
Definition: zr300.h:164
bool has_data() const
Definition: zr300.h:46
bool supports_option(rs_option option) const override
void start(rs_source source) override