OrbbecSDK  1.0.0
InternalTypes.h
浏览该文件的文档.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Orbbec Corporation. All Rights Reserved.
3 
9 #pragma once
10 
11 #if ( defined( WIN32 ) || defined( _WIN32 ) || defined( WINCE ) )
12 #ifdef OB_EXPORTS
13 #define OB_EXTENSION_API __declspec( dllexport )
14 #else
15 #define OB_EXTENSION_API __declspec( dllimport )
16 #endif
17 #else
18 #define OB_EXTENSION_API
19 #endif
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 #include <stdint.h>
25 #include <stdbool.h>
26 #pragma pack( push, 1 ) // struct 1-byte align
27 
28 #define OB_DEVICE_PROPERTY_BEGIN 0
29 #define OB_DEVICE_PROPERTY_END 999
30 #define OB_DATA_TYPE_BEGIN 1000
31 #define OB_DATA_TYPE_END 1999
32 #define OB_SENSOR_PROPERTY_BEGIN 2000
33 #define OB_SENSOR_PROPERTY_END 2999
34 #define OB_SDK_PROPERTY_BEGIN 3000
35 #define OB_SDK_PROPERTY_END 3499
36 #define OB_SDK_DATA_TYPE_BEGIN 3500
37 #define OB_SDK_DATA_TYPE_END 3999
38 #define OB_RAW_DATA_BEGIN 4000
39 #define OB_RAW_DATA_END 4999
40 #define OB_DEVICE_DEBUG_PROPERTY_BEGIN 5000
41 #define OB_DEVICE_DEBUG_PROPERTY_END 5499
42 #define OB_DEVICE_DEBUG_DATA_TYPE_BEGIN 5500
43 #define OB_DEVICE_DEBUG_DATA_TYPE_END 5999
44 
52 typedef union {
53  struct _xyz {
54  float x;
55  float y;
56  float z;
57  } xyz;
58  float v[ 3 ];
59 } float3_t;
60 
65 typedef struct {
66  float x;
67  float y;
68  float z;
69 } ob_point;
70 
75 typedef struct {
76  float x;
77  float y;
78  float z;
79  float r;
80  float g;
81  float b;
83 
84 typedef struct {
85  float rotation[ 9 ];
86  float translation[ 3 ];
88 
89 typedef union {
90  int32_t intValue;
91  float floatValue;
93 
94 typedef double ob_time;
95 
96 typedef struct {
97  OBPropertyValue cur;
98  OBPropertyValue max;
99  OBPropertyValue min;
100  OBPropertyValue step;
101  OBPropertyValue def;
103 
104 typedef struct {
105  char firmwareVersion[ 16 ]; // 如:1.2.18
106  char hardwareVersion[ 16 ]; // 如:1.0.18
107  char sdkVersion[ 16 ]; // 支持最低sdk的版本号,sdk版本号:2.3.2(主.次.修订)
108  char depthChip[ 16 ]; // mx6000, mx6600
109  char systemChip[ 16 ]; // ar9201
110  char serialNumber[ 16 ]; // 序列号
111  int32_t deviceType; // 单目,双目,tof。枚举值
112  char deviceName[ 16 ]; // 设备名称 astra+
113  char subSystemVersion[ 16 ]; // 如:倚天剑的MCU固件版本 1.0.23
114  char resever[ 32 ]; // 保留
116 
120 typedef enum {
121  OB_ALIGN_ENABLE,
122  OB_ALIGN_DISABLE,
124 
125 typedef enum {
126  FILE_PORT_FIRMWARE_UPGRADE = 0,
127  FILE_PORT_CALIBRATION_UPGRADE = 1,
128  FILE_PORT_FILE_TURN = 2,
129 } file_port;
130 
131 typedef struct UpgradeStatus {
132  int16_t state;
133  int16_t percentage;
134  uint8_t message[ 256 ];
135 } UpgradeStatus;
136 
137 //获取浮点型数据传输结构体
138 typedef struct {
139  float cur;
140  float max;
141  float min;
142  float step;
143  float def;
145 // 整形范围数据传输结构体
146 typedef struct {
147  int32_t cur;
148  int32_t max;
149  int32_t min;
150  int32_t step;
151  int32_t def;
153 
154 // bool型范围数据传输结构体 (根据SDK与设备porperty类型数据通信协议,
155 // 必须保证结构体内每个字段都为4字节, 所以这里将各字段类型定义为uint32_t,
156 // uint32_t与bool类型转换遵循C++/C 语言标准规则)
157 typedef struct {
158  uint32_t cur;
159  uint32_t max;
160  uint32_t min;
161  uint32_t step;
162  uint32_t def;
164 
165 typedef struct {
166  float d_intr_p[ 4 ]; // 深度相机内参:[fx,fy,cx,cy]
167  float c_intr_p[ 4 ]; // 彩色相机内参:[fx,fy,cx,cy]
168  float d2c_r[ 9 ]; // 深度相机到彩色相机的旋转矩阵 [r00,r01,r02;r10,r11,r12;r20,r21,r22]
169  float d2c_t[ 3 ]; // 深度相机到彩色相机的平移矩阵 [t1,t2,t3]
170  float d_k[ 5 ]; // 深度相机畸变参数 [k1,k2,p1,p2,k3] // 注意k3的位置,这个是算法定的,有些代码k3排在k2后边
171  float c_k[ 5 ]; // 彩色相机畸变参数 [k1,k2,p1,p2,k3]
172  uint32_t c_img_size[ 2 ]; // 彩色标定分辨率 [color_width, color_height]
173  uint32_t d_img_size[ 2 ]; // 深度标定分辨率 [ir_width, ir_height]
174 
176 
181 typedef struct {
182  uint32_t maxSpeckleSize;
183  uint32_t maxDiff;
184  uint32_t filterType; // 0 表示对视差滤波, 1 表示对深度滤波 ,默认值是1
185  uint32_t isEnable; // 0 表示关闭, 1 表示开启
187 
192 typedef struct {
193  double fx;
194  double baseline;
195  double fCoefficient;
196  int32_t nShiftScale;
197  double disparityCoeff;
198  int32_t maxDepthValue;
199  int32_t minDepthValue;
201 
206 typedef struct {
207  double fZeroPlaneDistance; // 表示标定平面Z0
208  double nParamCoeff;
209  double fZeroPlanePixelSize;
210  float fEmitterDComsDistance; // 标定的基线:baseline
211  double nShiftScale;
212  int32_t nConstShift;
213  int32_t maxDepthValue;
214  int32_t minDepthValue;
215  int32_t nPixelSizeFactor;
217 
222 typedef union {
225  int32_t isEnable; // 0代表关闭, 1 表示开启
227 
232 typedef struct {
233  ob_disparity_process_parameter disparityParameter;
234  ob_soft_filter_parameter softFilterParameter;
235  int32_t isDualCamera;
236  bool rleDecodeEnable;
238 
239 typedef struct {
240  float fBaseline;
241  float fZ0;
243 
244 typedef struct {
245  float cpuTemp;
246  float irTemp;
247  float ldmTemp;
248  float mainBoardTemp;
249  float tecTemp;
250  float imuTemp;
252 
253 typedef struct {
254  uint32_t min;
255  uint32_t max;
257 
258 typedef struct {
259  RANGE expTime;
260  RANGE AGain;
261  RANGE laserCurrent;
262  uint32_t targetBrightness;
263  uint32_t targetThd;
264  uint32_t centerWeight;
265  uint32_t skipFrame;
266  uint32_t smoothSteps;
267  uint32_t delay_ms;
268  uint32_t meterMethod;
269  uint8_t expTimeAdj;
270  uint8_t AGainAdj;
271  uint8_t laserCurrentAdj;
272  uint8_t reserve;
274 
275 typedef struct {
276  float fDCmosEmitterDistance;
277  float fDCmosRCmosDistance;
278  float fReferenceDistance;
279  float fReferencePixelSize;
281 
282 typedef struct {
283  int16_t state;
284  int16_t percentage;
285  uint8_t message[ 256 ];
287 
288 typedef struct {
289  float tx_temp;
290  float rx_temp;
292 
293 typedef struct {
294  int32_t mode; // 1: 表示单频调制,2: 表示双频调制
295  int32_t freq_A; //第一个调制频率(单频调制只有A频率有效)
296  int32_t freq_B; //第二个调制频率
297  int32_t reseved; //保留位
299 
300 typedef struct {
301  int32_t mode; // 1: 表示单频调制,2: 表示双频调制
302  float duty_A; //第一个调制信号占空比, 取值省略百分号,如:54.2
303  float duty_B; //第二个调制信号占空比
304  float reseved; //保留位
306 
307 typedef struct {
308  // filter size
309  int32_t win_x;
310  int32_t win_y;
311  float sigma_x; // x sigma
312  float sigma_y; // y sigma
313  uint8_t bypass; // skip or not; 滤波开关
315 
316 typedef struct {
317  int32_t d; // filter distance
318  float sigma_color; // color sigma
319  float sigma_space; // space sigma
320  uint8_t bypass; // skip or not; 滤波开关
322 
323 typedef struct {
324  float thres; // thres for fly point filtering
325  float noise_coeff; // noise coeff;
326  uint8_t fill_hole; // fill the hole after fly point filtering
327  uint8_t bypass; // skip or not, 滤波开关
329 
330 typedef struct {
331  int32_t win_size; // window size
332  uint8_t bypass; // skip or not; 滤波开关
334 
335 typedef struct {
336  float confidence_thres;
337  uint8_t bypass; // skip or not; 滤波开关
339 
340 typedef struct {
341  int32_t nearest_length; //最近距离, 单位:mm
342  int32_t farthest_length; //最远距离, 单位:mm
344 
345 typedef struct {
346  int32_t upper; // 阈值上限, 单位:ms
347  int32_t lower; // 阈值下限, 单位:ms
349 
350 typedef enum {
351  NORMAL = 0,
352  OPEN_STREAM_OPERATION_ERROR = 1, //开流异常
353 } DeviceStateType;
354 
355 typedef struct {
356  DeviceStateType type; //设备状态类型
357  char msg[ 256 ]; //设备状态具体信息
359 
360 typedef struct {
361  float m_SetPointVoltage;
362  float m_CompensationVoltage;
363  uint16_t m_TecDutyCycle; // duty cycle on heater/cooler
364  uint16_t m_HeatMode; // TRUE - heat, FALSE - cool
365  float m_ProportionalError;
366  float m_IntegralError;
367  float m_DerivativeError;
368  uint16_t m_ScanMode; // 0 - crude, 1 - precise
369  float m_Pvar;
370  float m_Ivar;
371  float m_Dvar;
373 
374 // IMU采样率值枚举(陀螺仪或加速度计)
375 typedef enum {
376  OB_IMU_ODR_1_5625_HZ = 1,
377  OB_IMU_ODR_3_125_HZ,
378  OB_IMU_ODR_6_25_HZ,
379  OB_IMU_ODR_12_5_HZ,
380  OB_IMU_ODR_25_HZ,
381  OB_IMU_ODR_50_HZ,
382  OB_IMU_ODR_100_HZ,
383  OB_IMU_ODR_200_HZ,
384  OB_IMU_ODR_500_HZ,
385  OB_IMU_ODR_1_KHZ,
386  OB_IMU_ODR_2_KHZ,
387  OB_IMU_ODR_4_KHZ,
388  OB_IMU_ODR_8_KHZ,
389  OB_IMU_ODR_16_KHZ,
390  OB_IMU_ODR_32_KHZ,
391 } OB_IMU_ODR_EM,
392  OB_GYRO_ODR_EM, OB_ACCEL_ODR_EM;
393 
394 //陀螺仪量程枚举
395 typedef enum {
396  OB_GYRO_FS_16dps = 1,
397  OB_GYRO_FS_31dps,
398  OB_GYRO_FS_62dps,
399  OB_GYRO_FS_125dps,
400  OB_GYRO_FS_245dps,
401  OB_GYRO_FS_250dps,
402  OB_GYRO_FS_500dps,
403  OB_GYRO_FS_1000dps,
404  OB_GYRO_FS_2000dps,
405 } OB_GYRO_FS_EM;
406 
407 //加速度计量程枚举
408 typedef enum {
409  OB_ACCEL_FS_2g = 1,
410  OB_ACCEL_FS_4g,
411  OB_ACCEL_FS_8g,
412  OB_ACCEL_FS_16g,
413 } OB_ACCEL_FS_EM;
414 
415 //深度单位枚举
416 typedef enum {
417  OB_DEPTH_UNIT_MM_0P1,
418  OB_DEPTH_UNIT_MM_0P2,
419  OB_DEPTH_UNIT_MM_0P25,
420  OB_DEPTH_UNIT_MM_0P4,
421  OB_DEPTH_UNIT_MM_0P8,
422  OB_DEPTH_UNIT_MM_1P6,
423 } OB_DEPTH_UNIT_EM;
424 
425 //加速度计/陀螺仪支持的采样率列表
426 typedef struct {
427  uint32_t num; //支持的采样率个数(最大不超过16个)
428  OB_IMU_ODR_EM odr[ 16 ]; //采样率枚举值存放
430 
431 //陀螺仪支持的量程列表
432 typedef struct {
433  uint32_t num; //支持的量程个数(最大不超过16个)
434  OB_GYRO_FS_EM fs[ 16 ]; //量程枚举值存放
436 
437 //加速度计支持的量程列表
438 typedef struct {
439  uint32_t num; //支持的量程个数(最大不超过16个)
440  OB_ACCEL_FS_EM fs[ 16 ]; //量程枚举值存放
442 
443 // IMU数据帧上报结构体
444 typedef struct {
445  float fAccData[ 3 ]; // 三个方向加速度值(xyz),单位:g
446  float fGyrData[ 3 ]; // 三个方向角速度值(xyz),单位:dps
447  uint32_t timestamp; // 时间戳,单位:us
448  uint32_t temp; // 摄氏度
450 
451 typedef struct {
452  uint64_t time; // sdk->dev: 授时时间; dev->sdk: 设备当前时间
453  uint64_t rtt; // sdk->dev: 命令往返时间,设备接收到后将时间设置为time+rtt/2; dev->sdk: reserve
455 
456 typedef struct {
457  char numberStr[ 12 ];
459 
460 //同步模式
461 typedef enum {
462  OB_SYNC_OFF = 0x00, //关闭同步
463  OB_SYNC_OFFLINE_MODE = 0x01, //单机模式 (rgb --> tof)
464  OB_SYNC_ONLINE_HOST_MODE = 0x02, // host模式 (rgb --> tof、ext_out)
465  OB_SYNC_ONLINE_SLAVE_MODE = 0x03, // slave模式 (ext_in --> rgb、tof、ext_out)
466  OB_SYNC_ONLINE_MCU_MODE = 0x04, // muc-host模式 (mcu --> rgb、tof、ext_out)
467 } OB_SYNC_MODE_EM;
468 
469 typedef struct {
470  OB_SYNC_MODE_EM sync_mode; // 0:关闭同步,1:单机模式,2:host模式,3:slave模式, 4: mcu-host
471  uint16_t tof_phase_delay; // us
472  uint16_t rgb_phase_delay; // us
473  uint16_t mout_phase_delay; // us
474  uint16_t mout_oc_polarity; // 0:正向脉冲, 1: 负向脉冲
475  uint16_t mcu_host_fps; // mcu 主模式时的触发帧率
477 
478 typedef struct {
479  float temp_Cal_IR; // Calibration temperature of IR module.
480  float temp_Cal_Laser; // Calibration temperature of Laser module.
481  float ncost_IR; // Temperature coefficient of IR module.
482  float ncost_Laser; // Temperature coefficient of Laser module.
484 
485 #define OB_ACTIVATION_CODE_SIZE 49
486 typedef struct {
487  uint8_t ActiveCode[ OB_ACTIVATION_CODE_SIZE ];
489 
490 typedef enum { OB_TOF_FILTER_RANGE_CLOSE = 0, OB_TOF_FILTER_RANGE_MIDDLE = 1, OB_TOF_FILTER_RANGE_LONG = 2, OB_TOF_FILTER_RANGE_DEBUG = 100 } TOF_FILTER_RANGE;
491 #pragma pack( pop )
492 
493 #ifdef __cplusplus
494 }
495 #endif
软件滤波参数
带有颜色信息的3D点描述
Definition: InternalTypes.h:75
双目视差转深度所需参数
深度处理所需的相关参数
ob_align_status
对齐参数
单目视差转深度所需参数
视差转深度所需参数
SDK中3D点描述
Definition: InternalTypes.h:65