Astra SDK  v2.1.3
body_types.h
1 // This file is part of the Orbbec Astra SDK [https://orbbec3d.com]
2 // Copyright (c) 2015-2017 Orbbec 3D
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // Be excellent to each other.
17 #ifndef BODY_TYPES_H
18 #define BODY_TYPES_H
19 
20 #include <astra_core/capi/astra_types.h>
21 #include <astra/capi/astra_ctypes.h>
22 
27 #define ASTRA_MAX_JOINTS 19
28 
29 #define ASTRA_INVALID_BODY_ID 0
30 #define ASTRA_MIN_BODY_ID 1
31 #define ASTRA_MAX_BODY_ID 255
32 #define ASTRA_MAX_BODIES 6
33 
34 #define ASTRA_TEMP_IMAGE_WIDTH 640
35 #define ASTRA_TEMP_IMAGE_HEIGHT 480
36 #define ASTRA_TEMP_IMAGE_LENGTH ASTRA_TEMP_IMAGE_WIDTH*ASTRA_TEMP_IMAGE_HEIGHT
37 
42 typedef enum _astra_joint_type {
44  ASTRA_JOINT_HEAD = 0,
46  ASTRA_JOINT_SHOULDER_SPINE = 1,
48  ASTRA_JOINT_LEFT_SHOULDER = 2,
50  ASTRA_JOINT_LEFT_ELBOW = 3,
52  ASTRA_JOINT_LEFT_HAND = 4,
54  ASTRA_JOINT_RIGHT_SHOULDER = 5,
56  ASTRA_JOINT_RIGHT_ELBOW = 6,
58  ASTRA_JOINT_RIGHT_HAND = 7,
60  ASTRA_JOINT_MID_SPINE = 8,
62  ASTRA_JOINT_BASE_SPINE = 9,
64  ASTRA_JOINT_LEFT_HIP = 10,
66  ASTRA_JOINT_LEFT_KNEE = 11,
68  ASTRA_JOINT_LEFT_FOOT = 12,
70  ASTRA_JOINT_RIGHT_HIP = 13,
72  ASTRA_JOINT_RIGHT_KNEE = 14,
74  ASTRA_JOINT_RIGHT_FOOT = 15,
76  ASTRA_JOINT_LEFT_WRIST = 16,
78  ASTRA_JOINT_RIGHT_WRIST = 17,
80  ASTRA_JOINT_NECK = 18,
82  ASTRA_JOINT_UNKNOWN = 255,
83 } astra_joint_type_v;
84 
92 typedef uint8_t astra_joint_type_t;
93 
98 typedef enum _astra_joint_status {
100  ASTRA_JOINT_STATUS_NOT_TRACKED = 0,
105  ASTRA_JOINT_STATUS_LOW_CONFIDENCE = 1,
107  ASTRA_JOINT_STATUS_TRACKED = 2,
108 } astra_joint_status_v;
109 
117 typedef uint8_t astra_joint_status_t;
118 
123 typedef struct _astra_joint {
128  astra_joint_type_t type;
133  astra_joint_status_t status;
139  // TODO: is this rotation relative to the parent? is Y up?
141 } astra_joint_t;
142 
147 typedef enum _astra_body_status {
149  ASTRA_BODY_STATUS_NOT_TRACKING = 0,
151  ASTRA_BODY_STATUS_LOST = 1,
153  ASTRA_BODY_STATUS_TRACKING_STARTED = 2,
155  ASTRA_BODY_STATUS_TRACKING = 3,
156 } astra_body_status_v;
157 
165 typedef uint8_t astra_body_status_t;
166 
172 typedef enum _astra_handpose {
174  ASTRA_HANDPOSE_UNKNOWN = 0,
176  ASTRA_HANDPOSE_GRIP = 1
177 } astra_handpose_v;
178 
185 typedef uint8_t astra_handpose_t;
186 
187 typedef struct _astra_handpose_info {
188  astra_handpose_t leftHand;
189  astra_handpose_t rightHand;
191 
198 typedef enum _astra_body_features {
200  ASTRA_BODY_TRACKING_SEGMENTATION = 0,
202  ASTRA_BODY_TRACKING_JOINTS = 1,
204  ASTRA_BODY_TRACKING_HAND_POSES = 3
205 } astra_body_tracking_feature_flags_v;
206 
213 typedef uint32_t astra_body_tracking_feature_flags_t;
214 
219 typedef enum _astra_skeleton_profile {
221  ASTRA_SKELETON_PROFILE_FULL = 0,
223  ASTRA_SKELETON_PROFILE_UPPER_BODY = 1,
225  ASTRA_SKELETON_PROFILE_BASIC = 2
226 } astra_skeleton_profile_v;
227 
234 typedef uint32_t astra_skeleton_profile_t;
235 
241 typedef enum _astra_skeleton_optimization {
242  ASTRA_SKELETON_OPTIMIZATION_1 = 1,
244  ASTRA_SKELETON_OPTIMIZATION_MINIMIZE_MEMORY = 2,
245  ASTRA_SKELETON_OPTIMIZATION_2 = 2,
246  ASTRA_SKELETON_OPTIMIZATION_3 = 3,
247  ASTRA_SKELETON_OPTIMIZATION_4 = 4,
249  ASTRA_SKELETON_OPTIMIZATION_BALANCED = 5,
250  ASTRA_SKELETON_OPTIMIZATION_5 = 5,
251  ASTRA_SKELETON_OPTIMIZATION_6 = 6,
252  ASTRA_SKELETON_OPTIMIZATION_7 = 7,
253  ASTRA_SKELETON_OPTIMIZATION_8 = 8,
254  ASTRA_SKELETON_OPTIMIZATION_9 = 9,
256  ASTRA_SKELETON_OPTIMIZATION_BEST_ACCURACY = 9,
257 } astra_skeleton_optimization_v;
258 
259 
267 typedef uint32_t astra_skeleton_optimization_t;
268 
269 typedef enum _astra_body_orientation {
270  ASTRA_BODY_ORIENTATION_TOP = 0,
271  ASTRA_BODY_ORIENTATION_LEFT = 1,
272  ASTRA_BODY_ORIENTATION_RIGHT = 2,
273 } astra_body_orientation_v;
274 
281 typedef uint32_t astra_body_orientation_t;
282 
287 typedef uint8_t astra_body_id_t;
288 
293 typedef struct _astra_body {
298  astra_body_tracking_feature_flags_t features;
306  astra_joint_t joints[ASTRA_MAX_JOINTS];
315  astra_body_id_t id;
321  astra_body_status_t status;
322 } astra_body_t;
323 
329 typedef struct _astra_body_list {
331  // astra_body_t* bodies;
332  astra_body_t bodies[ASTRA_MAX_BODIES];
334  int32_t count;
336 
344 typedef struct _astra_bitmapmask {
346  // uint8_t* data;
347  uint8_t data[ASTRA_TEMP_IMAGE_LENGTH];
349  int32_t width;
351  int32_t height;
353 
371 
386 typedef struct _astra_plane {
388  float a;
390  float b;
392  float c;
394  float d;
395 } astra_plane_t;
396 
401 typedef struct _astra_bodyframe_info {
403  int32_t width;
405  int32_t height;
407  int8_t isEstimated;
409 
414 typedef struct _astra_floor_info {
424  astra_bool_t floorDetected;
426 
427 typedef struct _astra_bodyframe* astra_bodyframe_t;
429 
430 typedef struct {
431  astra_body_id_t bodyId;
432  astra_body_tracking_feature_flags_t feature;
434 
435 #endif /* BODY_TYPES_H */
Struct representing a 2-dimensional bitmask
Definition: body_types.h:344
uint8_t data[ASTRA_TEMP_IMAGE_LENGTH]
mask pixels
Definition: body_types.h:347
int32_t height
height in pixels
Definition: body_types.h:351
int32_t width
width in pixels
Definition: body_types.h:349
Struct containing a variable-sized array of astra_body_t structs
Definition: body_types.h:329
int32_t count
Number of astra_body_t in bodies
Definition: body_types.h:334
astra_body_t bodies[ASTRA_MAX_BODIES]
Pointer to an array of astra_body_t
Definition: body_types.h:332
Struct containing body tracking information
Definition: body_types.h:293
astra_body_status_t status
Tracking status
Definition: body_types.h:321
astra_body_tracking_feature_flags_t features
Bitmask of features that are enabled.
Definition: body_types.h:298
astra_joint_t joints[ASTRA_MAX_JOINTS]
Array of tracked joints
Definition: body_types.h:306
astra_vector3f_t centerOfMass
Single point describing the center of mass of a body.
Definition: body_types.h:304
astra_handpose_info_t handPoses
Hand poses
Definition: body_types.h:308
astra_body_id_t id
Persistent Id
Definition: body_types.h:315
Struct containing general body frame information
Definition: body_types.h:401
int32_t width
Frame width
Definition: body_types.h:403
int32_t height
Frame height
Definition: body_types.h:405
int8_t isEstimated
If the frame was estimated due to a slow CPU
Definition: body_types.h:407
Definition: stream_types.h:62
Struct containing floor information about the scene
Definition: body_types.h:414
astra_floormask_t floorMask
Floor mask
Definition: body_types.h:416
astra_bool_t floorDetected
If the floor is detected, ASTRA_TRUE. Otherwise, ASTRA_FALSE.
Definition: body_types.h:424
astra_plane_t floorPlane
Floor plane
Definition: body_types.h:418
Definition: body_types.h:187
Joint information
Definition: body_types.h:123
astra_vector2f_t depthPosition
Depth ("projective") position of joint
Definition: body_types.h:135
astra_joint_status_t status
Joint status
Definition: body_types.h:133
astra_matrix3x3_t orientation
3x3 Rotation matrix representing the rotation of this joint.
Definition: body_types.h:140
astra_vector3f_t worldPosition
Real world position of joint
Definition: body_types.h:137
astra_joint_type_t type
Joint type
Definition: body_types.h:128
Represents a 3x3 rotation matrix
Definition: astra_ctypes.h:50
Struct representing a geometric 3-dimensional plane
Definition: body_types.h:386
float d
D coefficient
Definition: body_types.h:394
float c
C coefficient
Definition: body_types.h:392
float a
A coefficient
Definition: body_types.h:388
float b
B coefficient
Definition: body_types.h:390
Definition: astra_plugin.h:24
Definition: body_types.h:430
Definition: astra_ctypes.h:27
Definition: astra_ctypes.h:32