Time-of-Flight Library(ToF) 3.11.1
 
camera_config.hpp
1#ifndef _CHRONOPTICS_TOF_CAMERA_CONFIG_HPP_
2#define _CHRONOPTICS_TOF_CAMERA_CONFIG_HPP_
3
4#include <chronoptics/tof/camera_config.h>
5
6#include <chronoptics/tof/processing_config.hpp>
7
8namespace chronoptics {
9namespace tof {
10
11/** ToF cameras made by Chronoptics
12 */
13enum class CameraType {
14 OPT8241 = 1, /** Original Moa and first generation Kea camera with opt sensor */
15 OPT8241_EXT = 4, /** First generation Kea camera with opt sensor and external modulation */
16 MLX75027 = 6, /** Newer generation Kea cameras with mlx sensor */
17 VD55H1 = 9, /** Kea st camera */
18};
19
20/** Operating mode of the cameras' sensor
21 */
22enum class SensorMode {
23 NORMAL = 0, /** Normal mode ToF sensor mod (A - B) */
24 COMMON = 1, /** Common mode (A + B) */
25 EXTERNAL_DEMOD = 4, /** Use external demodulation */
26 EXTERNAL_SIGNAL = 5, /** Use the light source as an input */
27 TAP_A = 8, /** Only tap a is read out */
28 TAP_B = 9, /** Only tap b is read out */
29 TAP_AB = 10, /** Both A and B tap are read out, this means double the data transmission */
30 TAP_AB_HDR = 12, /** Both A and B tap are read out for both a short and long integration time */
31};
32
33/** The trigger mode of the camera
34 */
35enum class TriggerMode {
36 CONTINUOUS = 0, /** The camera is continuously running and outputting frames */
37 HARDWARE = 1, /** The camera waits for a hardware trigger */
38 SOFTWARE = 2, /** The camera waits for a software trigger */
39};
40
41/** Region of interest
42*/
43class Roi : public detail::Base<tof_roi, tof_roi_delete> {
44 public:
45 /** Construct from pointer */
46 Roi(tof_roi_t ptr = nullptr) {
47 this->ptr_ = ptr;
48 }
49
50 /** Get the number of rows in the image sensor
51 * @return Number of rows
52 */
53 int32_t sensor_rows() const {
54 return tof_roi_sensor_rows(this->ptr_, TOF_ERROR_HANDLER{});
55 }
56
57 /** Get the number of columns in the image sensor
58 * @return Number of columsn
59 */
60 int32_t sensor_cols() const {
61 return tof_roi_sensor_cols(this->ptr_, TOF_ERROR_HANDLER{});
62 }
63
64 /** Get the row offset in pixels
65 * @return Row offset
66 */
67 int32_t get_row_offset() const {
68 return tof_roi_get_row_offset(this->ptr_, TOF_ERROR_HANDLER{});
69 }
70
71 /** Set the row offset in pixels
72 * @param row_offset Row offset
73 */
74 void set_row_offset(int32_t row_offset) {
75 return tof_roi_set_row_offset(this->ptr_, row_offset, TOF_ERROR_HANDLER{});
76 }
77
78 /** Get the column offset in pixels
79 * @return Column offset
80 */
81 int32_t get_col_offset() const {
82 return tof_roi_get_col_offset(this->ptr_, TOF_ERROR_HANDLER{});
83 }
84
85 /** Set the column offset in pixels
86 * @param col_offset Column offset
87 */
88 void set_col_offset(int32_t col_offset) {
89 return tof_roi_set_col_offset(this->ptr_, col_offset, TOF_ERROR_HANDLER{});
90 }
91
92 /** Get the number of rows in the output image
93 * @return Image rows
94 */
95 int32_t get_img_rows() const {
96 return tof_roi_get_img_rows(this->ptr_, TOF_ERROR_HANDLER{});
97 }
98
99 /** Set the number of rows in the output image
100 * @param img_rows Image rows
101 */
102 void set_img_rows(int32_t img_rows) {
103 return tof_roi_set_img_rows(this->ptr_, img_rows, TOF_ERROR_HANDLER{});
104 }
105
106 /** Get the number of columns in the output image
107 * @return Image columns
108 */
109 int32_t get_img_cols() const {
110 return tof_roi_get_img_cols(this->ptr_, TOF_ERROR_HANDLER{});
111 }
112
113 /** Set the number of columns in the output image
114 * @param img_cols Image columns
115 */
116 void set_img_cols(int32_t img_cols) {
117 return tof_roi_set_img_cols(this->ptr_, img_cols, TOF_ERROR_HANDLER{});
118 }
119
120};
121
122/** This class allows you to view/edit the camera settings
123*/
124class CameraConfig : public detail::Base<tof_camera_config, tof_camera_config_delete> {
125 public:
126 /** Construct from pointer */
127 CameraConfig(tof_camera_config_t ptr = nullptr) {
128 this->ptr_ = ptr;
129 }
130
131 /** Read camera config from disk
132 * @param file_location Location of camera config on disk
133 */
134 CameraConfig(StringView file_location) {
135 this->ptr_ = tof_camera_config_new_from_disk(file_location, TOF_ERROR_HANDLER{});
136 }
137
138 /** Write camera config to disk
139 * @param file_location Location to save camera config to
140 */
141 void write(StringView file_location) const {
142 return tof_camera_config_write(this->ptr_, file_location, TOF_ERROR_HANDLER{});
143 }
144
145 /** Get the camera type
146 * @return Camera type
147 */
148 CameraType get_type() const {
149 return static_cast<CameraType>(tof_camera_config_get_type(this->ptr_, TOF_ERROR_HANDLER{}));
150 }
151
152 /** Reset camera config to default
153 */
154 void reset() {
155 return tof_camera_config_reset(this->ptr_, TOF_ERROR_HANDLER{});
156 }
157
158 /** Get the amount of frames in the config. Having multiple frames allows you
159 * to configure different modulation frequencies or integration times per
160 * frame.
161 * @return Frame size
162 */
163 size_t frame_size() const {
164 return tof_camera_config_frame_size(this->ptr_, TOF_ERROR_HANDLER{});
165 }
166
167 /** Add a default frame to the camera config
168 */
169 void add_frame() {
170 return tof_camera_config_add_frame(this->ptr_, TOF_ERROR_HANDLER{});
171 }
172
173 /** Generate default processing config from camera configuration
174 * @return The default processing config
175 */
177 ProcessingConfig new_processing_config(static_cast<tof_processing_config_t>(nullptr));
178 auto ptr = reinterpret_cast<tof_processing_config_t*>(&new_processing_config);
179 *ptr = tof_camera_config_default_processing(this->ptr_, TOF_ERROR_HANDLER{});
180 return new_processing_config;
181 }
182
183 /** Erase specified frame
184 * @param frame Frame number
185 */
186 void erase_frame(size_t frame) {
187 return tof_camera_config_erase_frame(this->ptr_, frame, TOF_ERROR_HANDLER{});
188 }
189
190 /** Get the phase shifts. Value ranges from 0.0 to 1.0 which translates to 0-2
191 * pi
192 * @param frame Frame number
193 * @return Phase shifts
194 */
195 std::vector<float> get_phase_shifts(size_t frame) const {
196 size_t size = tof_camera_config_get_phase_shifts(this->ptr_, frame, nullptr, 0, TOF_ERROR_HANDLER{});
197 std::vector<float> vec(size);
198 size = tof_camera_config_get_phase_shifts(this->ptr_, frame, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
199 return vec;
200 }
201
202 /** Set the phase shifts. Value ranges from 0.0 to 1.0 which translates to 0-2
203 * pi
204 * @param frame Frame number
205 * @param phase_shifts Phase shifts
206 */
207 void set_phase_shifts(size_t frame, const std::vector<float> &phase_shifts) {
208 return tof_camera_config_set_phase_shifts(this->ptr_, frame, phase_shifts.data(), phase_shifts.size(), TOF_ERROR_HANDLER{});
209 }
210
211 /** Get the integration time
212 * @param frame Frame number
213 * @return Integration time in micro seconds
214 */
215 std::vector<uint32_t> get_integration_time(size_t frame) const {
216 size_t size = tof_camera_config_get_integration_time(this->ptr_, frame, nullptr, 0, TOF_ERROR_HANDLER{});
217 std::vector<uint32_t> vec(size);
218 size = tof_camera_config_get_integration_time(this->ptr_, frame, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
219 return vec;
220 }
221
222 /** Set the integration time
223 * @param frame Frame number
224 * @param integration_time Integration time in micro seconds
225 */
226 void set_integration_time(size_t frame, const std::vector<uint32_t> &integration_time) {
227 return tof_camera_config_set_integration_time(this->ptr_, frame, integration_time.data(), integration_time.size(), TOF_ERROR_HANDLER{});
228 }
229
230 /** Get the mode to set the camera's depth sensor to
231 * @param frame Frame number
232 * @return Sensor mode
233 */
234 SensorMode get_sensor_mode(size_t frame) const {
235 return static_cast<SensorMode>(tof_camera_config_get_sensor_mode(this->ptr_, frame, TOF_ERROR_HANDLER{}));
236 }
237
238 /** Set the mode to set the camera's depth sensor to
239 * @param frame Frame number
240 * @param sensor_mode Sensor mode
241 */
242 void set_sensor_mode(size_t frame, SensorMode sensor_mode) {
243 return tof_camera_config_set_sensor_mode(this->ptr_, frame, static_cast<tof_sensor_mode>(sensor_mode), TOF_ERROR_HANDLER{});
244 }
245
246 /** Get the modulation frequency
247 * @param frame Frame number
248 * @return Modulation frequency in MHz
249 */
250 float get_modulation_frequency(size_t frame) const {
251 return tof_camera_config_get_modulation_frequency(this->ptr_, frame, TOF_ERROR_HANDLER{});
252 }
253
254 /** Set the modulation frequency
255 * @param frame Frame number
256 * @param modulation_frequency Modulation frequency in MHz
257 */
258 void set_modulation_frequency(size_t frame, float modulation_frequency) {
259 return tof_camera_config_set_modulation_frequency(this->ptr_, frame, modulation_frequency, TOF_ERROR_HANDLER{});
260 }
261
262 /** Get the duty cycle
263 * @param frame Frame number
264 * @return Duty cycle 0.0 to 1.0
265 */
266 float get_duty_cycle(size_t frame) const {
267 return tof_camera_config_get_duty_cycle(this->ptr_, frame, TOF_ERROR_HANDLER{});
268 }
269
270 /** Set the duty cycle
271 * @param frame Frame number
272 * @param duty_cycle Duty cycle 0.0 to 1.0
273 */
274 void set_duty_cycle(size_t frame, float duty_cycle) {
275 return tof_camera_config_set_duty_cycle(this->ptr_, frame, duty_cycle, TOF_ERROR_HANDLER{});
276 }
277
278 /** Get the region of interest
279 * @param frame Frame number
280 * @return Region of interest
281 */
282 Roi get_roi(size_t frame) const {
283 Roi new_roi(static_cast<tof_roi_t>(nullptr));
284 auto ptr = reinterpret_cast<tof_roi_t*>(&new_roi);
285 *ptr = tof_camera_config_get_roi(this->ptr_, frame, TOF_ERROR_HANDLER{});
286 return new_roi;
287 }
288
289 /** Set the region of interest
290 * @param frame Frame number
291 * @param roi Region of interest
292 */
293 void set_roi(size_t frame, Roi &roi) {
294 return tof_camera_config_set_roi(this->ptr_, frame, *reinterpret_cast<tof_roi_t*>(&roi), TOF_ERROR_HANDLER{});
295 }
296
297 /** Get the amount of binning
298 * @param frame Frame number
299 * @return Amount of binning 0=none, 1=x2, 2=x4, 3=x8
300 */
301 uint8_t get_binning(size_t frame) const {
302 return tof_camera_config_get_binning(this->ptr_, frame, TOF_ERROR_HANDLER{});
303 }
304
305 /** Set the amount of binning
306 * @param frame Frame number
307 * @param binning Amount of binning 0=none, 1=x2, 2=x4, 3=x8
308 */
309 void set_binning(size_t frame, uint8_t binning) {
310 return tof_camera_config_set_binning(this->ptr_, frame, binning, TOF_ERROR_HANDLER{});
311 }
312
313 /** Get is the image flipped
314 * @param frame Frame number
315 * @return Image is flipped
316 */
317 bool get_flip(size_t frame) const {
318 return tof_camera_config_get_flip(this->ptr_, frame, TOF_ERROR_HANDLER{});
319 }
320
321 /** Set is the image flipped
322 * @param frame Frame number
323 * @param flip Image is flipped
324 */
325 void set_flip(size_t frame, bool flip) {
326 return tof_camera_config_set_flip(this->ptr_, frame, flip, TOF_ERROR_HANDLER{});
327 }
328
329 /** Get is the image mirrored
330 * @param frame Frame number
331 * @return Image is mirrored
332 */
333 bool get_mirror(size_t frame) const {
334 return tof_camera_config_get_mirror(this->ptr_, frame, TOF_ERROR_HANDLER{});
335 }
336
337 /** Set is the image mirrored
338 * @param frame Frame number
339 * @param mirror Image is mirrored
340 */
341 void set_mirror(size_t frame, bool mirror) {
342 return tof_camera_config_set_mirror(this->ptr_, frame, mirror, TOF_ERROR_HANDLER{});
343 }
344
345 /** Get the image sensor gain
346 * @return Image sensor gain
347 */
348 float get_gain() const {
349 return tof_camera_config_get_gain(this->ptr_, TOF_ERROR_HANDLER{});
350 }
351
352 /** Set the image sensor gain
353 * @param gain Image sensor gain
354 */
355 void set_gain(float gain) {
356 return tof_camera_config_set_gain(this->ptr_, gain, TOF_ERROR_HANDLER{});
357 }
358
359 /** Get the kind of camera synchronization
360 * @return The kind of sync mode. 0 waits for the vsync pulse before starting
361 * the next frame. 1 optional vsync 2 is no frame syncing
362 */
363 int32_t get_sync_mode() const {
364 return tof_camera_config_get_sync_mode(this->ptr_, TOF_ERROR_HANDLER{});
365 }
366
367 /** Set the kind of camera synchronization
368 * @param sync_mode The kind of sync mode. 0 waits for the vsync pulse before
369 * starting the next frame. 1 optional vsync 2 is no frame syncing
370 */
371 void set_sync_mode(int32_t sync_mode) {
372 return tof_camera_config_set_sync_mode(this->ptr_, sync_mode, TOF_ERROR_HANDLER{});
373 }
374
375 /** Get the maximum integration time possible
376 * @param frame Frame number
377 * @return Maximum integration time in micro seconds
378 */
379 std::vector<uint32_t> maximum_integration_time(size_t frame) {
380 size_t size = tof_camera_config_maximum_integration_time(this->ptr_, frame, nullptr, 0, TOF_ERROR_HANDLER{});
381 std::vector<uint32_t> vec(size);
382 size = tof_camera_config_maximum_integration_time(this->ptr_, frame, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
383 return vec;
384 }
385
386 /** Get the DAC gain
387 * @return The DAC gain
388 */
389 std::vector<uint16_t> get_dac() const {
390 size_t size = tof_camera_config_get_dac(this->ptr_, nullptr, 0, TOF_ERROR_HANDLER{});
391 std::vector<uint16_t> vec(size);
392 size = tof_camera_config_get_dac(this->ptr_, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
393 return vec;
394 }
395
396 /** Set the DAC gain
397 * @param dac The DAC gain
398 */
399 void set_dac(const std::vector<uint16_t> &dac) {
400 return tof_camera_config_set_dac(this->ptr_, dac.data(), dac.size(), TOF_ERROR_HANDLER{});
401 }
402
403 /** Get the mipi speed for the MLX75027
404 * @return The mipi speed. Can only be the values 300, 600, 704, 800 and 960
405 */
406 int32_t get_mlx_mipi_speed() const {
407 return tof_camera_config_get_mlx_mipi_speed(this->ptr_, TOF_ERROR_HANDLER{});
408 }
409
410 /** Set the mipi speed for the MLX75027
411 * @param mipi_speed The mipi speed. Can only be the values 300, 600, 704, 800
412 * and 960
413 */
414 void set_mlx_mipi_speed(int32_t mipi_speed) {
415 return tof_camera_config_set_mlx_mipi_speed(this->ptr_, mipi_speed, TOF_ERROR_HANDLER{});
416 }
417
418 /** Get the mipi speed
419 * @return The mipi speed
420 */
421 int32_t get_mipi_speed() const {
422 return tof_camera_config_get_mipi_speed(this->ptr_, TOF_ERROR_HANDLER{});
423 }
424
425 /** Set the mipi speed
426 * @param mipi_speed The mipi speed
427 */
428 void set_mipi_speed(int32_t mipi_speed) {
429 return tof_camera_config_set_mipi_speed(this->ptr_, mipi_speed, TOF_ERROR_HANDLER{});
430 }
431
432 /** Get the preheat time
433 * @param frame Frame number
434 * @return The preheat time
435 */
436 uint32_t get_mlx_preheat(size_t frame) const {
437 return tof_camera_config_get_mlx_preheat(this->ptr_, frame, TOF_ERROR_HANDLER{});
438 }
439
440 /** Set the preheat time
441 * @param frame Frame number
442 * @param preheat The preheat time
443 */
444 void set_mlx_preheat(size_t frame, uint32_t preheat) {
445 return tof_camera_config_set_mlx_preheat(this->ptr_, frame, preheat, TOF_ERROR_HANDLER{});
446 }
447
448 /** Get enable preheat
449 * @param frame Frame number
450 * @return Enable preheating
451 */
452 bool get_mlx_preheat_enable(size_t frame) const {
453 return tof_camera_config_get_mlx_preheat_enable(this->ptr_, frame, TOF_ERROR_HANDLER{});
454 }
455
456 /** Set enable preheat
457 * @param frame Frame number
458 * @param enable Enable preheating
459 */
460 void set_mlx_preheat_enable(size_t frame, bool enable) {
461 return tof_camera_config_set_mlx_preheat_enable(this->ptr_, frame, enable, TOF_ERROR_HANDLER{});
462 }
463
464 /** Set the Nios hex for the keaB cameras
465 * @param file_location File location of the nios hex file
466 */
467 void set_opt_kea_nios_hex(StringView file_location) {
468 return tof_camera_config_set_opt_kea_nios_hex(this->ptr_, file_location, TOF_ERROR_HANDLER{});
469 }
470
471 /** Get the opt8241 number of sub and quad frames
472 * @return Number of subs and quads respectively
473 */
474 std::array<int32_t, 2> get_opt_kea_sub_quad() const {
475 std::array<int32_t, 2> array;
476 auto data = tof_camera_config_get_opt_kea_sub_quad(this->ptr_, TOF_ERROR_HANDLER{});
477 std::copy(data, data + array.size(), array.data());
478 return array;
479 }
480
481 /** Set the opt8241 number of sub and quad frames
482 * @param subs_quads Number of subs and quads respectively
483 */
484 void set_opt_kea_sub_quad(const std::array<int32_t, 2> &subs_quads) {
485 return tof_camera_config_set_opt_kea_sub_quad(this->ptr_, subs_quads.data(), TOF_ERROR_HANDLER{});
486 }
487
488 /** Get the processing configuration for when the depth is calculated on
489 * camera
490 * @return The pipeline processing to be done on camera
491 */
493 ProcessingConfig new_processing_config(static_cast<tof_processing_config_t>(nullptr));
494 auto ptr = reinterpret_cast<tof_processing_config_t*>(&new_processing_config);
495 *ptr = tof_camera_config_get_processing(this->ptr_, TOF_ERROR_HANDLER{});
496 return new_processing_config;
497 }
498
499 /** Set the processing configuration for when the depth is calculated on
500 * camera
501 * @param processing The pipeline processing to be done on camera
502 */
504 return tof_camera_config_set_processing(this->ptr_, *reinterpret_cast<tof_processing_config_t*>(&processing), TOF_ERROR_HANDLER{});
505 }
506
507 /** Get the time this depth frame will take. This is useful when you want a
508 * steady but lower framerate.
509 * @param frame Frame number
510 * @return Frame time in micro seconds
511 */
512 uint32_t get_frame_time(size_t frame) const {
513 return tof_camera_config_get_frame_time(this->ptr_, frame, TOF_ERROR_HANDLER{});
514 }
515
516 /** Set the time this depth frame will take. This is useful when you want a
517 * steady but lower framerate.
518 * @param frame Frame number
519 * @param frame_time Frame time in micro seconds
520 */
521 void set_frame_time(size_t frame, uint32_t frame_time) {
522 return tof_camera_config_set_frame_time(this->ptr_, frame, frame_time, TOF_ERROR_HANDLER{});
523 }
524
525 /** Get phase offset for illumination and sensor. The phase offsets are two
526 * floating point values corresponding to the phase delay for the illumination
527 * and sensor respectively. The values should be between 0.0 and 1.0 where 0.0
528 * is no phase offset and 1.0 is 360 degree phase offset
529 * @param frame Frame number
530 * @return Image is mirrored
531 */
532 std::array<float, 2> get_global_phase_offset(size_t frame) const {
533 std::array<float, 2> array;
534 auto data = tof_camera_config_get_global_phase_offset(this->ptr_, frame, TOF_ERROR_HANDLER{});
535 std::copy(data, data + array.size(), array.data());
536 return array;
537 }
538
539 /** Set phase offset for illumination and sensor. The phase offsets are two
540 * floating point values corresponding to the phase delay for the illumination
541 * and sensor respectively. The values should be between 0.0 and 1.0 where 0.0
542 * is no phase offset and 1.0 is 360 degree phase offset
543 * @param frame Frame number
544 * @param phase_offset Image is mirrored
545 */
546 void set_global_phase_offset(size_t frame, const std::array<float, 2> &phase_offset) {
547 return tof_camera_config_set_global_phase_offset(this->ptr_, frame, phase_offset.data(), TOF_ERROR_HANDLER{});
548 }
549
550 /** Get the illumination mode
551 * @param frame Frame number
552 * @return Illumination mode. 0 is actively modulating, 2 is active low
553 * (illumination disabled) and 3 is active high
554 */
555 uint8_t get_illumination_mode(size_t frame) const {
556 return tof_camera_config_get_illumination_mode(this->ptr_, frame, TOF_ERROR_HANDLER{});
557 }
558
559 /** Set the illumination mode
560 * @param frame Frame number
561 * @param illumination_mode Illumination mode. 0 is actively modulating, 2 is
562 * active low (illumination disabled) and 3 is active high
563 */
564 void set_illumination_mode(size_t frame, uint8_t illumination_mode) {
565 return tof_camera_config_set_illumination_mode(this->ptr_, frame, illumination_mode, TOF_ERROR_HANDLER{});
566 }
567
568 /** Get the image offsets. This configuration is only for sensors with column
569 * phase offsets.
570 * @param frame Frame number
571 * @return The image offset per column in 0.0 to 1.0
572 */
573 std::vector<float> get_image_offsets(size_t frame) const {
574 size_t size = tof_camera_config_get_image_offsets(this->ptr_, frame, nullptr, 0, TOF_ERROR_HANDLER{});
575 std::vector<float> vec(size);
576 size = tof_camera_config_get_image_offsets(this->ptr_, frame, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
577 return vec;
578 }
579
580 /** Set the image offsets. This configuration is only for sensors with column
581 * phase offsets.
582 * @param frame Frame number
583 * @param image_offsets The image offset per column in 0.0 to 1.0
584 */
585 void set_image_offsets(size_t frame, const std::vector<float> &image_offsets) {
586 return tof_camera_config_set_image_offsets(this->ptr_, frame, image_offsets.data(), image_offsets.size(), TOF_ERROR_HANDLER{});
587 }
588
589 /** Get the width of the rgb sensor
590 * @return Width in pixels
591 */
592 size_t get_rgb_width() {
593 return tof_camera_config_get_rgb_width(this->ptr_, TOF_ERROR_HANDLER{});
594 }
595
596 /** Get the height of the rgb sensor
597 * @return Height in pixels
598 */
599 size_t get_rgb_height() {
600 return tof_camera_config_get_rgb_height(this->ptr_, TOF_ERROR_HANDLER{});
601 }
602
603 /** Get the trigger mode
604 * @return The trigger mode of the camera
605 */
606 TriggerMode get_trigger_mode() const {
607 return static_cast<TriggerMode>(tof_camera_config_get_trigger_mode(this->ptr_, TOF_ERROR_HANDLER{}));
608 }
609
610 /** Set the trigger mode
611 * @param trigger_mode The trigger mode of the camera
612 */
613 void set_trigger_mode(TriggerMode trigger_mode) {
614 return tof_camera_config_set_trigger_mode(this->ptr_, static_cast<tof_trigger_mode>(trigger_mode), TOF_ERROR_HANDLER{});
615 }
616
617 /** Get the maximum theoretical fps the camera can run
618 * @return The fps in Hz
619 */
621 return tof_camera_config_get_depth_fps(this->ptr_, TOF_ERROR_HANDLER{});
622 }
623
624};
625
626/** Test whether camera configurations are equal
627 * @param lhs First camera config
628 * @param rhs Second camera config
629 * @return Camera configurations are equal
630 */
631inline bool camera_config_equal(const CameraConfig &lhs, const CameraConfig &rhs) {
632 return tof_camera_config_equal(*reinterpret_cast<const tof_camera_config_t*>(&lhs), *reinterpret_cast<const tof_camera_config_t*>(&rhs), TOF_ERROR_HANDLER{});
633}
634
635} // tof
636} // chronoptics
637
638#endif
This class allows you to view/edit the camera settings.
void set_gain(float gain)
Set the image sensor gain.
void set_integration_time(size_t frame, const std::vector< uint32_t > &integration_time)
Set the integration time.
std::vector< float > get_phase_shifts(size_t frame) const
Get the phase shifts.
uint8_t get_illumination_mode(size_t frame) const
Get the illumination mode.
float get_duty_cycle(size_t frame) const
Get the duty cycle.
float get_depth_fps()
Get the maximum theoretical fps the camera can run.
void set_modulation_frequency(size_t frame, float modulation_frequency)
Set the modulation frequency.
SensorMode get_sensor_mode(size_t frame) const
Get the mode to set the camera's depth sensor to.
size_t get_rgb_height()
Get the height of the rgb sensor.
size_t frame_size() const
Get the amount of frames in the config.
void set_global_phase_offset(size_t frame, const std::array< float, 2 > &phase_offset)
Set phase offset for illumination and sensor.
uint32_t get_mlx_preheat(size_t frame) const
Get the preheat time.
void set_image_offsets(size_t frame, const std::vector< float > &image_offsets)
Set the image offsets.
ProcessingConfig default_processing() const
Generate default processing config from camera configuration.
void erase_frame(size_t frame)
Erase specified frame.
bool get_mirror(size_t frame) const
Get is the image mirrored.
void set_mlx_mipi_speed(int32_t mipi_speed)
Set the mipi speed for the MLX75027.
void set_phase_shifts(size_t frame, const std::vector< float > &phase_shifts)
Set the phase shifts.
void set_trigger_mode(TriggerMode trigger_mode)
Set the trigger mode.
std::array< int32_t, 2 > get_opt_kea_sub_quad() const
Get the opt8241 number of sub and quad frames.
int32_t get_sync_mode() const
Get the kind of camera synchronization.
void set_sync_mode(int32_t sync_mode)
Set the kind of camera synchronization.
void set_mlx_preheat_enable(size_t frame, bool enable)
Set enable preheat.
void set_mipi_speed(int32_t mipi_speed)
Set the mipi speed.
void add_frame()
Add a default frame to the camera config.
std::vector< uint32_t > maximum_integration_time(size_t frame)
Get the maximum integration time possible.
void set_flip(size_t frame, bool flip)
Set is the image flipped.
uint8_t get_binning(size_t frame) const
Get the amount of binning.
std::array< float, 2 > get_global_phase_offset(size_t frame) const
Get phase offset for illumination and sensor.
std::vector< uint32_t > get_integration_time(size_t frame) const
Get the integration time.
void set_mlx_preheat(size_t frame, uint32_t preheat)
Set the preheat time.
uint32_t get_frame_time(size_t frame) const
Get the time this depth frame will take.
bool get_flip(size_t frame) const
Get is the image flipped.
void set_dac(const std::vector< uint16_t > &dac)
Set the DAC gain.
std::vector< uint16_t > get_dac() const
Get the DAC gain.
CameraConfig(tof_camera_config_t ptr=nullptr)
Construct from pointer.
Roi get_roi(size_t frame) const
Get the region of interest.
std::vector< float > get_image_offsets(size_t frame) const
Get the image offsets.
ProcessingConfig get_processing() const
Get the processing configuration for when the depth is calculated on camera.
int32_t get_mlx_mipi_speed() const
Get the mipi speed for the MLX75027.
float get_modulation_frequency(size_t frame) const
Get the modulation frequency.
CameraConfig(StringView file_location)
Read camera config from disk.
bool get_mlx_preheat_enable(size_t frame) const
Get enable preheat.
void reset()
Reset camera config to default.
size_t get_rgb_width()
Get the width of the rgb sensor.
void set_illumination_mode(size_t frame, uint8_t illumination_mode)
Set the illumination mode.
int32_t get_mipi_speed() const
Get the mipi speed.
void set_roi(size_t frame, Roi &roi)
Set the region of interest.
void set_mirror(size_t frame, bool mirror)
Set is the image mirrored.
void set_duty_cycle(size_t frame, float duty_cycle)
Set the duty cycle.
void set_binning(size_t frame, uint8_t binning)
Set the amount of binning.
void write(StringView file_location) const
Write camera config to disk.
void set_frame_time(size_t frame, uint32_t frame_time)
Set the time this depth frame will take.
void set_processing(ProcessingConfig &processing)
Set the processing configuration for when the depth is calculated on camera.
TriggerMode get_trigger_mode() const
Get the trigger mode.
void set_opt_kea_sub_quad(const std::array< int32_t, 2 > &subs_quads)
Set the opt8241 number of sub and quad frames.
void set_opt_kea_nios_hex(StringView file_location)
Set the Nios hex for the keaB cameras.
float get_gain() const
Get the image sensor gain.
void set_sensor_mode(size_t frame, SensorMode sensor_mode)
Set the mode to set the camera's depth sensor to.
CameraType get_type() const
Get the camera type.
Processing that can be done.
Region of interest.
int32_t get_img_rows() const
Get the number of rows in the output image.
int32_t get_img_cols() const
Get the number of columns in the output image.
int32_t sensor_cols() const
Get the number of columns in the image sensor.
void set_img_rows(int32_t img_rows)
Set the number of rows in the output image.
int32_t get_row_offset() const
Get the row offset in pixels.
void set_img_cols(int32_t img_cols)
Set the number of columns in the output image.
void set_col_offset(int32_t col_offset)
Set the column offset in pixels.
void set_row_offset(int32_t row_offset)
Set the row offset in pixels.
int32_t sensor_rows() const
Get the number of rows in the image sensor.
int32_t get_col_offset() const
Get the column offset in pixels.
Roi(tof_roi_t ptr=nullptr)
Construct from pointer.