orbbec-sdk-sys 0.1.2+2.5.5

Low-level Rust bindings for https://github.com/orbbec/OrbbecSDK_v2
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.

/**
 * @file StreamProfile.h
 * @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
 *
 */
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include "ObTypes.h"

/**
 * @brief Create a stream profile object
 *
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_stream_profile* return the stream profile object
 */
OB_EXPORT ob_stream_profile *ob_create_stream_profile(ob_stream_type type, ob_format format, ob_error **error);

/**
 * @brief Create a video stream profile object
 *
 * @param[in] type Stream type
 * @param[in] format Stream format
 * @param[in] width Stream width
 * @param[in] height Stream height
 * @param[in] fps Stream frame rate
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_stream_profile* return the video stream profile object
 */
OB_EXPORT ob_stream_profile *ob_create_video_stream_profile(ob_stream_type type, ob_format format, uint32_t width, uint32_t height, uint32_t fps,
                                                            ob_error **error);

/**
 * @brief Create a accel stream profile object
 *
 * @param[in] full_scale_range Accel full scale range
 * @param[in] sample_rate Accel sample rate
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_stream_profile* return the accel stream profile object
 */
OB_EXPORT ob_stream_profile *ob_create_accel_stream_profile(ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);

/**
 * @brief Create a gyro stream profile object
 *
 * @param[in] full_scale_range Gyro full scale range
 * @param[in] sample_rate Gyro sample rate
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_stream_profile* return the accel stream profile object
 */
OB_EXPORT ob_stream_profile *ob_create_gyro_stream_profile(ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);

/**
 * @brief Copy the stream profile object from an other stream profile object
 *
 * @param[in] srcProfile Source stream profile object
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 *
 * @return ob_stream_profile* return the new stream profile object
 */
OB_EXPORT ob_stream_profile *ob_create_stream_profile_from_other_stream_profile(const ob_stream_profile *srcProfile, ob_error **error);

/**
 * @brief Copy the stream profile object with a new format object
 *
 * @param[in] profile Stream profile object
 * @param[in] new_format New format
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 *
 * @return ob_stream_profile* return the new stream profile object with the new format
 */
OB_EXPORT ob_stream_profile *ob_create_stream_profile_with_new_format(const ob_stream_profile *profile, ob_format new_format, ob_error **error);

/**
 * @brief Delete the stream configuration.
 *
 * @param[in] profile Stream profile object .
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_delete_stream_profile(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get stream profile format
 *
 * @param[in] profile Stream profile object
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_format return the format of the stream
 */
OB_EXPORT ob_format ob_stream_profile_get_format(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set stream profile format
 *
 * @param[in] profile Stream profile object
 * @param[in] format The format of the stream
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_stream_profile_set_format(ob_stream_profile *profile, ob_format format, ob_error **error);

/**
 * @brief Get stream profile type
 *
 * @param[in] profile Stream profile object
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_stream_type stream type
 */
OB_EXPORT ob_stream_type ob_stream_profile_get_type(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set stream profile type
 *
 * @param[in] profile Stream profile object
 * @param[in] type The type of the stream
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_stream_profile_set_type(const ob_stream_profile *profile, ob_stream_type type, ob_error **error);

/**
 * @brief Get the extrinsic for source stream to target stream
 *
 * @param[in] source Source stream profile
 * @param[in]  target Target stream profile
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_extrinsic The extrinsic
 */
OB_EXPORT ob_extrinsic ob_stream_profile_get_extrinsic_to(const ob_stream_profile *source, ob_stream_profile *target, ob_error **error);

/**
 * @brief Set the extrinsic for source stream to target stream
 *
 * @param[in] source Stream profile object
 * @param[in] target  Target stream type
 * @param[in] extrinsic The extrinsic
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_stream_profile_set_extrinsic_to(ob_stream_profile *source, const ob_stream_profile *target, ob_extrinsic extrinsic, ob_error **error);

/**
 * @brief Set the extrinsic for source stream to target stream type
 *
 * @param[in] source Source stream profile
 * @param[in]  type Target stream type
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_extrinsic The extrinsic
 */
OB_EXPORT void ob_stream_profile_set_extrinsic_to_type(ob_stream_profile *source, const ob_stream_type type, ob_extrinsic extrinsic, ob_error **error);

/**
 * @brief Get the frame rate of the video stream
 *
 * @param[in] profile Stream profile object
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return uint32_t return the frame rate of the stream
 */
OB_EXPORT uint32_t ob_video_stream_profile_get_fps(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get the width of the video stream
 *
 * @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return uint32_t return the width of the stream
 */
OB_EXPORT uint32_t ob_video_stream_profile_get_width(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the width of the video stream
 *
 * @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
 * @param[in] width The width of the stream
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_video_stream_profile_set_width(ob_stream_profile *profile, uint32_t width, ob_error **error);

/**
 * @brief Get the height of the video stream
 *
 * @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
 * @param[out] error  Pointer to an error object that will be set if an error occurs.
 * @return uint32_t return the height of the stream
 */
OB_EXPORT uint32_t ob_video_stream_profile_get_height(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the height of the video stream
 *
 * @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
 * @param[in] height The height of the stream
 * @param[out] error  Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_video_stream_profile_set_height(ob_stream_profile *profile, uint32_t height, ob_error **error);

/**
 * @brief Get the intrinsic of the video stream profile
 *
 * @param[in]  profile Stream profile object
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 * @return ob_camera_intrinsic Return the intrinsic of the stream
 */
OB_EXPORT ob_camera_intrinsic ob_video_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the intrinsic of the video stream profile
 *
 * @param[in] profile Stream profile object
 * @param[in]  intrinsic The intrinsic of the stream
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_video_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_camera_intrinsic intrinsic, ob_error **error);

/**
 * @brief Get the distortion of the video stream profile
 *
 * @param[in]  profile Stream profile object
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 * @return ob_camera_distortion Return the distortion of the stream
 */
OB_EXPORT ob_camera_distortion ob_video_stream_profile_get_distortion(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the distortion of the video stream profile
 *
 * @param[in] profile Stream profile object
 * @param[in]  distortion The distortion of the stream
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_video_stream_profile_set_distortion(ob_stream_profile *profile, ob_camera_distortion distortion, ob_error **error);

/**
 * @brief Get the process param of the disparity stream
 *
 * @param[in]  profile Stream profile object
 * @param[out] error   Pointer to an error object that will be set if an error occurs.
 * @return ob_disparity_param Return the disparity process param of the stream
 */
OB_EXPORT ob_disparity_param ob_disparity_based_stream_profile_get_disparity_param(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the disparity process param of the disparity stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the disparity stream, an error will be returned.
 * @param[in] param The disparity process param of the disparity stream.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_disparity_based_stream_profile_set_disparity_param(ob_stream_profile *profile, ob_disparity_param param, ob_error **error);

/**
 * @brief Get the full-scale range of the accelerometer stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The full-scale range of the accelerometer stream.
 */
OB_EXPORT ob_accel_full_scale_range ob_accel_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get the sampling frequency of the accelerometer frame.
 *
 * @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The sampling frequency of the accelerometer frame.
 */
OB_EXPORT ob_accel_sample_rate ob_accel_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get the intrinsic of the accelerometer stream.
 *
 * @param[in]  profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_accel_intrinsic Return the intrinsic of the accelerometer stream.
 */
OB_EXPORT ob_accel_intrinsic ob_accel_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the intrinsic of the accelerometer stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
 * @param[in]  intrinsic The intrinsic of the accelerometer stream.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_accel_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_accel_intrinsic intrinsic, ob_error **error);

/**
 * @brief Get the full-scale range of the gyroscope stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The full-scale range of the gyroscope stream.
 */
OB_EXPORT ob_gyro_full_scale_range ob_gyro_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get the sampling frequency of the gyroscope stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The sampling frequency of the gyroscope stream.
 */
OB_EXPORT ob_gyro_sample_rate ob_gyro_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Get the intrinsic of the gyroscope stream.
 *
 * @param[in]  profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return ob_gyro_intrinsic Return the intrinsic of the gyroscope stream.
 */
OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile *profile, ob_error **error);

/**
 * @brief Set the intrinsic of the gyroscope stream.
 *
 * @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
 * @param[in]  intrinsic The intrinsic of the gyroscope stream.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_gyro_stream_set_intrinsic(ob_stream_profile *profile, ob_gyro_intrinsic intrinsic, ob_error **error);

/**
 * @brief Get the number of StreamProfile lists.
 *
 * @param[in] profile_list StreamProfile list.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The number of StreamProfile lists.
 */
OB_EXPORT uint32_t ob_stream_profile_list_get_count(const ob_stream_profile_list *profile_list, ob_error **error);

/**
 * @brief Get the corresponding StreamProfile by subscripting.
 *
 * @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
 *
 * @param[in] profile_list StreamProfile lists.
 * @param[in] index Index.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The matching profile.
 */
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_profile(const ob_stream_profile_list *profile_list, int index, ob_error **error);

/**
 * @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
 * the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
 *
 * @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
 *
 * @param[in] profile_list Resolution list.
 * @param[in] width Width. If you don't need to add matching conditions, you can pass OB_WIDTH_ANY.
 * @param[in] height Height. If you don't need to add matching conditions, you can pass OB_HEIGHT_ANY.
 * @param[in] format Format. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
 * @param[in] fps Frame rate. If you don't need to add matching conditions, you can pass OB_FPS_ANY.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The matching profile.
 */
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile(const ob_stream_profile_list *profile_list, int width, int height,
                                                                             ob_format format, int fps, ob_error **error);

/**
 * @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
 * the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
 *
 * @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
 *
 * @param[in] profile_list Resolution list.
 * @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
 * @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The matching profile.
 */
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_accel_stream_profile(const ob_stream_profile_list *profile_list,
                                                                             ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate,
                                                                             ob_error **error);

/**
 * @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
 * the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
 *
 * @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
 *
 * @param[in] profile_list Resolution list.
 * @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
 * @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 * @return The matching profile.
 */
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_gyro_stream_profile(const ob_stream_profile_list *profile_list,
                                                                            ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate,
                                                                            ob_error **error);

/**
 * @brief Delete the stream profile list.
 *
 * @param[in] profile_list Stream configuration list.
 * @param[out] error Pointer to an error object that will be set if an error occurs.
 */
OB_EXPORT void ob_delete_stream_profile_list(const ob_stream_profile_list *profile_list, ob_error **error);

// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_stream_profile_format ob_stream_profile_get_format
#define ob_stream_profile_type ob_stream_profile_get_type
#define ob_video_stream_profile_fps ob_video_stream_profile_get_fps
#define ob_video_stream_profile_width ob_video_stream_profile_get_width
#define ob_video_stream_profile_height ob_video_stream_profile_get_height
#define ob_accel_stream_profile_full_scale_range ob_accel_stream_profile_get_full_scale_range
#define ob_accel_stream_profile_sample_rate ob_accel_stream_profile_get_sample_rate
#define ob_gyro_stream_profile_full_scale_range ob_gyro_stream_profile_get_full_scale_range
#define ob_gyro_stream_profile_sample_rate ob_gyro_stream_profile_get_sample_rate
#define ob_stream_profile_list_count ob_stream_profile_list_get_count

#ifdef __cplusplus
}
#endif