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