Time-of-Flight Library(ToF) 4.0.1
 
user_config.hpp
1#ifndef _CHRONOPTICS_TOF_USER_CONFIG_HPP_
2#define _CHRONOPTICS_TOF_USER_CONFIG_HPP_
3
4#include <chronoptics/tof/user_config.h>
5
6#include <chronoptics/tof/camera_config.hpp>
7#include <chronoptics/tof/camera.hpp>
8#include <chronoptics/tof/processing_config.hpp>
9
10namespace chronoptics {
11namespace tof {
12
13/** Optimized configurations for different use cases
14 */
15enum class ConfigMode {
16 LONG_RANGE_DYNAMIC_SCENE = 1, /** Suitable for most applications */
17 MEDIUM_RANGE_DYNAMIC_SCENE = 2, /** For fast moving applications */
18 MEDIUM_RANGE_BALANCED = 3, /** Balanced between range, speed and accuracy */
19 SHORT_RANGE_HIGH_SPEED = 4, /** Maximum speed mode for short range and fast moving applications */
20 LONG_RANGE_HIGH_RESOLUTION = 5, /** Full resolution long range */
21 MEDIUM_RANGE_STATIC_SCENE = 6, /** Full resolution for slow changing scene */
22 FAR_OUT_STATIC_SCENE = 7, /** Full resolution for slow changing scene */
23};
24
25/** Get the camera config associated with the config mode
26 * @param camera Camera
27 * @param config_mode Config mode
28 * @return Camera Config
29 */
30inline CameraConfig config_mode_camera_config(Camera &camera, ConfigMode config_mode) {
31 CameraConfig new_camera_config(static_cast<tof_camera_config_t>(nullptr));
32 auto ptr = reinterpret_cast<tof_camera_config_t*>(&new_camera_config);
33 *ptr = tof_config_mode_camera_config(*reinterpret_cast<tof_camera_t*>(&camera), static_cast<tof_config_mode>(config_mode), TOF_ERROR_HANDLER{});
34 return new_camera_config;
35}
36
37/** Get the processing config associated with the config mode
38 * @param camera Camera
39 * @param config_mode Config mode
40 * @return Processing Config
41 */
42inline ProcessingConfig config_mode_processing_config(Camera &camera, ConfigMode config_mode) {
43 ProcessingConfig new_processing_config(static_cast<tof_processing_config_t>(nullptr));
44 auto ptr = reinterpret_cast<tof_processing_config_t*>(&new_processing_config);
45 *ptr = tof_config_mode_processing_config(*reinterpret_cast<tof_camera_t*>(&camera), static_cast<tof_config_mode>(config_mode), TOF_ERROR_HANDLER{});
46 return new_processing_config;
47}
48
49/** Check whether hdr is possible with current camera config
50 * @param config The camera config to check
51 * @return Whether hdr is possible
52 */
53inline bool hdr_possible(const CameraConfig &config) {
54 return tof_hdr_possible(*reinterpret_cast<const tof_camera_config_t*>(&config), TOF_ERROR_HANDLER{});
55}
56
57/** Check whether phase unwrap is possible with current camera config
58 * @param config The camera config to check
59 * @return Whether phase unwrap is possible
60 */
61inline bool phase_unwrap_possible(const CameraConfig &config) {
62 return tof_phase_unwrap_possible(*reinterpret_cast<const tof_camera_config_t*>(&config), TOF_ERROR_HANDLER{});
63}
64
65/** Generate processing config based on camera configuration and calibration.
66 * @param camera A camera
67 */
68inline void apply_default_processing_config(Camera &camera) {
69 return tof_apply_default_processing_config(*reinterpret_cast<tof_camera_t*>(&camera), TOF_ERROR_HANDLER{});
70}
71
72} // tof
73} // chronoptics
74
75#endif