00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __XN_TYPES_H__
00026 #define __XN_TYPES_H__
00027
00028
00029
00030
00031 #include <XnStatus.h>
00032 #include <XnOS.h>
00033
00034
00035
00036
00038 #define XN_MAX_NAME_LENGTH 80
00039
00041 #define XN_MAX_CREATION_INFO_LENGTH 255
00042
00044 #define XN_MAX_LICENSE_LENGTH 255
00045
00047 #define XN_NODE_WAIT_FOR_DATA_TIMEOUT 2000
00048
00050 #define XN_VENDOR_OPEN_NI "OpenNI"
00051
00053 #define XN_FORMAT_NAME_ONI "oni"
00054
00055
00056
00057
00058 struct XnInternalNodeData;
00059
00060
00061
00062
00063
00064 #pragma pack (push, 1)
00065
00069 typedef struct XnContext XnContext;
00070
00074 typedef struct XnInternalNodeData* XnNodeHandle;
00075
00079 typedef XnUInt32 XnLockHandle;
00080
00084 typedef enum XnProductionNodeType
00085 {
00087 XN_NODE_TYPE_DEVICE = 1,
00088
00090 XN_NODE_TYPE_DEPTH = 2,
00091
00093 XN_NODE_TYPE_IMAGE = 3,
00094
00096 XN_NODE_TYPE_AUDIO = 4,
00097
00099 XN_NODE_TYPE_IR = 5,
00100
00102 XN_NODE_TYPE_USER = 6,
00103
00105 XN_NODE_TYPE_RECORDER = 7,
00106
00108 XN_NODE_TYPE_PLAYER = 8,
00109
00111 XN_NODE_TYPE_GESTURE = 9,
00112
00114 XN_NODE_TYPE_SCENE = 10,
00115
00117 XN_NODE_TYPE_HANDS = 11,
00118
00120 XN_NODE_TYPE_CODEC = 12,
00121 } XnProductionNodeType;
00122
00126 typedef struct XnVersion
00127 {
00128 XnUInt8 nMajor;
00129 XnUInt8 nMinor;
00130 XnUInt16 nMaintenance;
00131 XnUInt32 nBuild;
00132 } XnVersion;
00133
00137 typedef struct XnProductionNodeDescription
00138 {
00140 XnProductionNodeType Type;
00142 XnChar strVendor[XN_MAX_NAME_LENGTH];
00144 XnChar strName[XN_MAX_NAME_LENGTH];
00146 XnVersion Version;
00147 } XnProductionNodeDescription;
00148
00152 typedef struct XnNodeInfo XnNodeInfo;
00153
00157 typedef struct XnNodeInfoListNode XnNodeInfoListNode;
00158
00162 typedef struct XnNodeInfoList XnNodeInfoList;
00163
00167 typedef struct XnNodeInfoListIterator
00168 {
00169 XnNodeInfoListNode* pCurrent;
00170 } XnNodeInfoListIterator;
00171
00172 typedef struct XnNodeQuery XnNodeQuery;
00173
00177 typedef struct XnLicense
00178 {
00180 XnChar strVendor[XN_MAX_NAME_LENGTH];
00182 XnChar strKey[XN_MAX_LICENSE_LENGTH];
00183 } XnLicense;
00184
00189 typedef struct XnEnumerationErrors XnEnumerationErrors;
00190
00194 typedef void* XnModuleNodeHandle;
00195
00202 typedef void (XN_CALLBACK_TYPE* XnStateChangedHandler)(XnNodeHandle hNode, void* pCookie);
00203
00210 typedef void (XN_CALLBACK_TYPE* XnErrorStateChangedHandler)(XnStatus errorState, void* pCookie);
00211
00213 typedef void* XnCallbackHandle;
00214
00215 typedef struct XnModuleExportedProductionNodeInterface XnModuleExportedProductionNodeInterface;
00216
00217
00218
00219
00220
00222 typedef XnUInt16 XnDepthPixel;
00223
00225 #define XN_DEPTH_NO_SAMPLE_VALUE ((XnDepthPixel)0)
00226
00228 typedef struct XnRGB24Pixel
00229 {
00230 XnUInt8 nRed;
00231 XnUInt8 nGreen;
00232 XnUInt8 nBlue;
00233 } XnRGB24Pixel;
00234
00236 typedef struct XnYUV422DoublePixel
00237 {
00238 XnUInt8 nU;
00239 XnUInt8 nY1;
00240 XnUInt8 nV;
00241 XnUInt8 nY2;
00242 } XnYUV422DoublePixel;
00243
00245 typedef XnUInt8 XnGrayscale8Pixel;
00246
00248 typedef XnUInt16 XnGrayscale16Pixel;
00249
00251 typedef XnGrayscale16Pixel XnIRPixel;
00252
00254 typedef XnUInt16 XnLabel;
00255
00256
00257
00258
00259 #define XN_CAPABILITY_EXTENDED_SERIALIZATION "ExtendedSerialization"
00260 #define XN_CAPABILITY_MIRROR "Mirror"
00261 #define XN_CAPABILITY_ALTERNATIVE_VIEW_POINT "AlternativeViewPoint"
00262 #define XN_CAPABILITY_CROPPING "Cropping"
00263 #define XN_CAPABILITY_USER_POSITION "UserPosition"
00264 #define XN_CAPABILITY_SKELETON "User::Skeleton"
00265 #define XN_CAPABILITY_POSE_DETECTION "User::PoseDetection"
00266 #define XN_CAPABILITY_LOCK_AWARE "LockAware"
00267 #define XN_CAPABILITY_ERROR_STATE "ErrorState"
00268 #define XN_CAPABILITY_FRAME_SYNC "FrameSync"
00269
00270
00271
00272
00273
00274 #define XN_QQVGA_X_RES 160
00275 #define XN_QQVGA_Y_RES 120
00276
00277 #define XN_CGA_X_RES 320
00278 #define XN_CGA_Y_RES 200
00279
00280 #define XN_QVGA_X_RES 320
00281 #define XN_QVGA_Y_RES 240
00282
00283 #define XN_VGA_X_RES 640
00284 #define XN_VGA_Y_RES 480
00285
00286 #define XN_SVGA_X_RES 800
00287 #define XN_SVGA_Y_RES 600
00288
00289 #define XN_XGA_X_RES 1024
00290 #define XN_XGA_Y_RES 768
00291
00292 #define XN_720P_X_RES 1280
00293 #define XN_720P_Y_RES 720
00294
00295 #define XN_SXGA_X_RES 1280
00296 #define XN_SXGA_Y_RES 1024
00297
00298 #define XN_UXGA_X_RES 1600
00299 #define XN_UXGA_Y_RES 1200
00300
00301 #define XN_1080P_X_RES 1920
00302 #define XN_1080P_Y_RES 1080
00303
00304 typedef enum XnResolution
00305 {
00306 XN_RES_CUSTOM = 0,
00307 XN_RES_QQVGA = 1,
00308 XN_RES_CGA = 2,
00309 XN_RES_QVGA = 3,
00310 XN_RES_VGA = 4,
00311 XN_RES_SVGA = 5,
00312 XN_RES_XGA = 6,
00313 XN_RES_720P = 7,
00314 XN_RES_SXGA = 8,
00315 XN_RES_UXGA = 9,
00316 XN_RES_1080P = 10,
00317 } XnResolution;
00318
00322 typedef struct XnMapOutputMode
00323 {
00325 XnUInt32 nXRes;
00327 XnUInt32 nYRes;
00329 XnUInt32 nFPS;
00330 } XnMapOutputMode;
00331
00332 typedef enum XnSampleRate
00333 {
00334 XN_SAMPLE_RATE_8K = 8000,
00335 XN_SAMPLE_RATE_11K = 11025,
00336 XN_SAMPLE_RATE_12K = 12000,
00337 XN_SAMPLE_RATE_16K = 16000,
00338 XN_SAMPLE_RATE_22K = 22050,
00339 XN_SAMPLE_RATE_24K = 24000,
00340 XN_SAMPLE_RATE_32K = 32000,
00341 XN_SAMPLE_RATE_44K = 44100,
00342 XN_SAMPLE_RATE_48K = 48000,
00343 } XnSampleRate;
00344
00345 typedef struct XnWaveOutputMode
00346 {
00347 XnUInt32 nSampleRate;
00348 XnUInt16 nBitsPerSample;
00349 XnUInt8 nChannels;
00350 } XnWaveOutputMode;
00351
00355 typedef struct XnVector3D
00356 {
00357 XnFloat X;
00358 XnFloat Y;
00359 XnFloat Z;
00360 } XnVector3D;
00361
00362 typedef XnVector3D XnPoint3D;
00363
00367 typedef struct XnBoundingBox3D
00368 {
00369 XnPoint3D LeftBottomNear;
00370 XnPoint3D RightTopFar;
00371 } XnBoundingBox3D;
00372
00376 typedef struct XnCropping
00377 {
00379 XnBool bEnabled;
00381 XnUInt16 nXOffset;
00383 XnUInt16 nYOffset;
00385 XnUInt16 nXSize;
00387 XnUInt16 nYSize;
00388 } XnCropping;
00389
00393 typedef struct XnFieldOfView
00394 {
00396 XnDouble fHFOV;
00398 XnDouble fVFOV;
00399 } XnFieldOfView;
00400
00401 typedef enum XnPixelFormat
00402 {
00403 XN_PIXEL_FORMAT_RGB24 = 1,
00404 XN_PIXEL_FORMAT_YUV422 = 2,
00405 XN_PIXEL_FORMAT_GRAYSCALE_8_BIT = 3,
00406 XN_PIXEL_FORMAT_GRAYSCALE_16_BIT = 4,
00407 } XnPixelFormat;
00408
00409 typedef struct XnSupportedPixelFormats
00410 {
00411 XnBool m_bRGB24 : 1;
00412 XnBool m_bYUV422 : 1;
00413 XnBool m_bGrayscale8Bit : 1;
00414 XnBool m_bGrayscale16Bit : 1;
00415 XnUInt m_nPadding : 4;
00416 XnUInt m_nReserved : 24;
00417 } XnSupportedPixelFormats;
00418
00419 typedef enum XnPlayerSeekOrigin
00420 {
00421 XN_PLAYER_SEEK_SET = 0,
00422 XN_PLAYER_SEEK_CUR = 1,
00423 XN_PLAYER_SEEK_END = 2,
00424 } XnPlayerSeekOrigin;
00425
00426
00427 typedef XnUInt32 XnUserID;
00428 typedef XnFloat XnConfidence;
00429
00431 typedef struct XnMatrix3X3
00432 {
00434 XnFloat elements[9];
00435 } XnMatrix3X3;
00436
00441 typedef struct XnPlane3D
00442 {
00444 XnVector3D vNormal;
00445
00447 XnPoint3D ptPoint;
00448 } XnPlane3D;
00449
00454 typedef struct XnSkeletonJointPosition
00455 {
00457 XnVector3D position;
00458
00460 XnConfidence fConfidence;
00461 } XnSkeletonJointPosition;
00462
00470 typedef struct XnSkeletonJointOrientation
00471 {
00473 XnMatrix3X3 orientation;
00475 XnConfidence fConfidence;
00476 } XnSkeletonJointOrientation;
00477
00481 typedef struct XnSkeletonJointTransformation
00482 {
00484 XnSkeletonJointPosition position;
00486 XnSkeletonJointOrientation orientation;
00487 } XnSkeletonJointTransformation;
00488
00492 typedef enum XnSkeletonJoint
00493 {
00494 XN_SKEL_HEAD = 1,
00495 XN_SKEL_NECK = 2,
00496 XN_SKEL_TORSO = 3,
00497 XN_SKEL_WAIST = 4,
00498
00499 XN_SKEL_LEFT_COLLAR = 5,
00500 XN_SKEL_LEFT_SHOULDER = 6,
00501 XN_SKEL_LEFT_ELBOW = 7,
00502 XN_SKEL_LEFT_WRIST = 8,
00503 XN_SKEL_LEFT_HAND = 9,
00504 XN_SKEL_LEFT_FINGERTIP =10,
00505
00506 XN_SKEL_RIGHT_COLLAR =11,
00507 XN_SKEL_RIGHT_SHOULDER =12,
00508 XN_SKEL_RIGHT_ELBOW =13,
00509 XN_SKEL_RIGHT_WRIST =14,
00510 XN_SKEL_RIGHT_HAND =15,
00511 XN_SKEL_RIGHT_FINGERTIP =16,
00512
00513 XN_SKEL_LEFT_HIP =17,
00514 XN_SKEL_LEFT_KNEE =18,
00515 XN_SKEL_LEFT_ANKLE =19,
00516 XN_SKEL_LEFT_FOOT =20,
00517
00518 XN_SKEL_RIGHT_HIP =21,
00519 XN_SKEL_RIGHT_KNEE =22,
00520 XN_SKEL_RIGHT_ANKLE =23,
00521 XN_SKEL_RIGHT_FOOT =24
00522 } XnSkeletonJoint;
00523
00525 typedef enum XnSkeletonProfile
00526 {
00528 XN_SKEL_PROFILE_NONE = 1,
00529
00531 XN_SKEL_PROFILE_ALL = 2,
00532
00534 XN_SKEL_PROFILE_UPPER = 3,
00535
00537 XN_SKEL_PROFILE_LOWER = 4,
00538
00540 XN_SKEL_PROFILE_HEAD_HANDS = 5,
00541 } XnSkeletonProfile;
00542
00543
00551 typedef void (XN_CALLBACK_TYPE* XnUserHandler)(XnNodeHandle hNode, XnUserID user, void* pCookie);
00552
00553
00563 typedef void (XN_CALLBACK_TYPE* XnHandCreate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
00564
00574 typedef void (XN_CALLBACK_TYPE* XnHandUpdate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
00575
00584 typedef void (XN_CALLBACK_TYPE* XnHandDestroy)(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie);
00585
00586
00596 typedef void (XN_CALLBACK_TYPE* XnGestureRecognized)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
00606 typedef void (XN_CALLBACK_TYPE* XnGestureProgress)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
00607
00608
00616 typedef void (XN_CALLBACK_TYPE* XnCalibrationStart)(XnNodeHandle hNode, XnUserID user, void* pCookie);
00625 typedef void (XN_CALLBACK_TYPE* XnCalibrationEnd)(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie);
00626
00627
00636 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionCallback)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie);
00637
00638
00639
00640
00641
00647 typedef enum XnRecordMedium
00648 {
00650 XN_RECORD_MEDIUM_FILE = 0,
00651 } XnRecordMedium;
00652
00654 typedef XnUInt32 XnCodecID;
00655
00657 #define XN_CODEC_ID(c1, c2, c3, c4) (XnCodecID)((c4 << 24) | (c3 << 16) | (c2 << 8) | c1)
00658
00664 typedef struct XnRecorderOutputStreamInterface
00665 {
00671 XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
00672
00681 XnStatus (XN_CALLBACK_TYPE* Write)(void* pCookie, const XnChar* strNodeName,
00682 const void* pData, XnUInt32 nSize);
00683
00691 XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnUInt32 nOffset);
00692
00701 XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
00702
00708 void (XN_CALLBACK_TYPE* Close)(void* pCookie);
00709 } XnRecorderOutputStreamInterface;
00710
00716 typedef struct XnPlayerInputStreamInterface
00717 {
00723 XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
00724
00734 XnStatus (XN_CALLBACK_TYPE* Read)(void* pCookie, void* pBuffer, XnUInt32 nSize, XnUInt32* pnBytesRead);
00735
00743 XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
00744
00752 XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
00753
00759 void (XN_CALLBACK_TYPE* Close)(void* pCookie);
00760 } XnPlayerInputStreamInterface;
00761
00765 typedef struct XnNodeNotifications
00766 {
00773 XnStatus (XN_CALLBACK_TYPE* OnNodeAdded)
00774 (void* pCookie, const XnChar* strNodeName, XnProductionNodeType type,
00775 XnCodecID compression);
00776
00783 XnStatus (XN_CALLBACK_TYPE* OnNodeRemoved)
00784 (void* pCookie, const XnChar* strNodeName);
00785
00794 XnStatus (XN_CALLBACK_TYPE* OnNodeIntPropChanged)
00795 (void* pCookie, const XnChar* strNodeName,
00796 const XnChar* strPropName, XnUInt64 nValue);
00797
00806 XnStatus (XN_CALLBACK_TYPE* OnNodeRealPropChanged)
00807 (void* pCookie, const XnChar* strNodeName,
00808 const XnChar* strPropName, XnDouble dValue);
00809
00818 XnStatus (XN_CALLBACK_TYPE* OnNodeStringPropChanged)
00819 (void* pCookie, const XnChar* strNodeName,
00820 const XnChar* strPropName, const XnChar* strValue);
00821
00831 XnStatus (XN_CALLBACK_TYPE* OnNodeGeneralPropChanged)
00832 (void* pCookie, const XnChar* strNodeName,
00833 const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer);
00834
00841 XnStatus (XN_CALLBACK_TYPE* OnNodeStateReady)
00842 (void* pCookie, const XnChar* strNodeName);
00843
00853 XnStatus (XN_CALLBACK_TYPE* OnNodeNewData)
00854 (void* pCookie, const XnChar* strNodeName,
00855 XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize);
00856
00857 } XnNodeNotifications;
00858
00860 typedef struct XnUInt32XYPair
00861 {
00862 XnUInt32 X;
00863 XnUInt32 Y;
00864 } XnUInt32XYPair;
00865
00867 typedef struct XnOutputMetaData
00868 {
00870 XnUInt64 nTimestamp;
00871
00873 XnUInt32 nFrameID;
00874
00876 XnUInt32 nDataSize;
00877
00879 XnBool bIsNew;
00880
00881 } XnOutputMetaData;
00882
00884 typedef struct XnMapMetaData
00885 {
00887 XnOutputMetaData* pOutput;
00888
00890 XnUInt32XYPair Res;
00891
00893 XnUInt32XYPair Offset;
00894
00896 XnUInt32XYPair FullRes;
00897
00899 XnPixelFormat PixelFormat;
00900
00902 XnUInt32 nFPS;
00903 } XnMapMetaData;
00904
00906 typedef struct XnDepthMetaData
00907 {
00909 XnMapMetaData* pMap;
00910
00912 const XnDepthPixel* pData;
00913
00915 XnDepthPixel nZRes;
00916 } XnDepthMetaData;
00917
00919 typedef struct XnImageMetaData
00920 {
00922 XnMapMetaData* pMap;
00923
00925 const XnUInt8* pData;
00926 } XnImageMetaData;
00927
00929 typedef struct XnIRMetaData
00930 {
00932 XnMapMetaData* pMap;
00933
00935 const XnIRPixel* pData;
00936 } XnIRMetaData;
00937
00938 typedef struct XnAudioMetaData
00939 {
00941 XnOutputMetaData* pOutput;
00942
00944 XnWaveOutputMode Wave;
00945
00947 const XnUInt8* pData;
00948 } XnAudioMetaData;
00949
00950 typedef struct XnSceneMetaData
00951 {
00953 XnMapMetaData* pMap;
00954
00956 const XnLabel* pData;
00957 } XnSceneMetaData;
00958
00959 #pragma pack (pop)
00960
00961 #endif //__XN_TYPES_H__