OpenNI 1.5.7
XnTypes.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * OpenNI 1.x Alpha *
4 * Copyright (C) 2012 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *****************************************************************************/
21 #ifndef __XN_TYPES_H__
22 #define __XN_TYPES_H__
23 
24 //---------------------------------------------------------------------------
25 // Includes
26 //---------------------------------------------------------------------------
27 #include <XnStatus.h>
28 #include <XnOS.h>
29 
30 //---------------------------------------------------------------------------
31 // Defines
32 //---------------------------------------------------------------------------
34 #define XN_MAX_NAME_LENGTH 80
35 
37 #define XN_MAX_CREATION_INFO_LENGTH 255
38 
40 #define XN_MAX_LICENSE_LENGTH 255
41 
43 #define XN_NODE_WAIT_FOR_DATA_TIMEOUT 2000
44 
46 #define XN_VENDOR_OPEN_NI "OpenNI"
47 
49 #define XN_FORMAT_NAME_ONI "oni"
50 
52 #define XN_SCRIPT_FORMAT_XML "xml"
53 
55 #define XN_PLAYBACK_SPEED_FASTEST 0.0
56 
58 #define XN_AUTO_CONTROL XN_MIN_INT32
59 
61 #define XN_PAUSE_AUTO_CONTROL XN_MAX_INT32
62 
63 //---------------------------------------------------------------------------
64 // Forward Declarations
65 //---------------------------------------------------------------------------
66 struct XnInternalNodeData;
67 
68 //---------------------------------------------------------------------------
69 // Types
70 //---------------------------------------------------------------------------
71 
72 #if XN_PLATFORM != XN_PLATFORM_ARC
73 #pragma pack (push, 1)
74 #endif
75 
79 typedef struct XnContext XnContext;
80 
84 typedef struct XnInternalNodeData* XnNodeHandle;
85 
89 typedef XnUInt32 XnLockHandle;
90 
94 typedef XnInt32 XnProductionNodeType;
95 
100 {
103 
106 
109 
112 
115 
118 
121 
124 
127 
130 
133 
136 
139 
145 
147 
149 
153 typedef struct XnVersion
154 {
155  XnUInt8 nMajor;
156  XnUInt8 nMinor;
157  XnUInt16 nMaintenance;
158  XnUInt32 nBuild;
159 } XnVersion;
160 
165 {
175 
179 typedef struct XnNodeInfo XnNodeInfo;
180 
185 
190 
195 {
198 
199 typedef struct XnNodeQuery XnNodeQuery;
200 
204 typedef struct XnLicense
205 {
210 } XnLicense;
211 
217 
221 typedef void* XnModuleNodeHandle;
222 
229 typedef void (XN_CALLBACK_TYPE* XnStateChangedHandler)(XnNodeHandle hNode, void* pCookie);
230 
237 typedef void (XN_CALLBACK_TYPE* XnErrorStateChangedHandler)(XnStatus errorState, void* pCookie);
238 
244 typedef void (XN_CALLBACK_TYPE* XnFreeHandler)(const void* pData);
245 
246 typedef void (XN_CALLBACK_TYPE* XnContextShuttingDownHandler)(XnContext* pContext, void* pCookie);
247 
258 typedef void (XN_CALLBACK_TYPE* XnNodeCreationHandler)(XnContext* pContext, XnNodeHandle hCreatedNode, void* pCookie);
259 
267 typedef void (XN_CALLBACK_TYPE* XnNodeDestructionHandler)(XnContext* pContext, const XnChar* strDestroyedNodeName, void* pCookie);
268 
270 typedef void* XnCallbackHandle;
271 
273 
274 //---------------------------------------------------------------------------
275 // 3D Vision Types
276 //---------------------------------------------------------------------------
278 typedef XnUInt16 XnDepthPixel;
279 
281 #define XN_DEPTH_NO_SAMPLE_VALUE ((XnDepthPixel)0)
282 
284 typedef struct XnRGB24Pixel
285 {
286  XnUInt8 nRed;
287  XnUInt8 nGreen;
288  XnUInt8 nBlue;
289 } XnRGB24Pixel;
290 
292 typedef struct XnYUV422DoublePixel
293 {
294  XnUInt8 nU;
295  XnUInt8 nY1;
296  XnUInt8 nV;
297  XnUInt8 nY2;
299 
301 typedef XnUInt8 XnGrayscale8Pixel;
302 
304 typedef XnUInt16 XnGrayscale16Pixel;
305 
308 
310 typedef XnUInt16 XnLabel;
311 
312 //---------------------------------------------------------------------------
313 // Generators Capabilities
314 //---------------------------------------------------------------------------
315 #define XN_CAPABILITY_EXTENDED_SERIALIZATION "ExtendedSerialization"
316 #define XN_CAPABILITY_MIRROR "Mirror"
317 #define XN_CAPABILITY_ALTERNATIVE_VIEW_POINT "AlternativeViewPoint"
318 #define XN_CAPABILITY_CROPPING "Cropping"
319 #define XN_CAPABILITY_USER_POSITION "UserPosition"
320 #define XN_CAPABILITY_SKELETON "User::Skeleton"
321 #define XN_CAPABILITY_POSE_DETECTION "User::PoseDetection"
322 #define XN_CAPABILITY_LOCK_AWARE "LockAware"
323 #define XN_CAPABILITY_ERROR_STATE "ErrorState"
324 #define XN_CAPABILITY_FRAME_SYNC "FrameSync"
325 #define XN_CAPABILITY_DEVICE_IDENTIFICATION "DeviceIdentification"
326 #define XN_CAPABILITY_BRIGHTNESS "Brightness"
327 #define XN_CAPABILITY_CONTRAST "Contrast"
328 #define XN_CAPABILITY_HUE "Hue"
329 #define XN_CAPABILITY_SATURATION "Saturation"
330 #define XN_CAPABILITY_SHARPNESS "Sharpness"
331 #define XN_CAPABILITY_GAMMA "Gamma"
332 #define XN_CAPABILITY_COLOR_TEMPERATURE "ColorTemperature"
333 #define XN_CAPABILITY_BACKLIGHT_COMPENSATION "BacklightCompensation"
334 #define XN_CAPABILITY_GAIN "Gain"
335 #define XN_CAPABILITY_PAN "Pan"
336 #define XN_CAPABILITY_TILT "Tilt"
337 #define XN_CAPABILITY_ROLL "Roll"
338 #define XN_CAPABILITY_ZOOM "Zoom"
339 #define XN_CAPABILITY_EXPOSURE "Exposure"
340 #define XN_CAPABILITY_AUTO_EXPOSURE "AutoExposure"
341 #define XN_CAPABILITY_IRIS "Iris"
342 #define XN_CAPABILITY_FOCUS "Focus"
343 #define XN_CAPABILITY_LOW_LIGHT_COMPENSATION "LowLightCompensation"
344 #define XN_CAPABILITY_ANTI_FLICKER "AntiFlicker"
345 #define XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE "Hands::HandTouchingFOVEdge"
346 
347 // Backwards compatibility - typo was fixed
348 #define XN_CAPABILITY_ANTI_FILCKER XN_CAPABILITY_ANTI_FLICKER
349 
350 // deprecated pragma is only supported in Visual Studio
351 #if (XN_PLATFORM == XN_PLATFORM_WIN32)
352 #pragma deprecated("XN_CAPABILITY_ANTI_FILCKER")
353 #endif
354 
355 //---------------------------------------------------------------------------
356 // Generators API Structs
357 //---------------------------------------------------------------------------
358 
359 #define XN_QQVGA_X_RES 160
360 #define XN_QQVGA_Y_RES 120
361 
362 #define XN_CGA_X_RES 320
363 #define XN_CGA_Y_RES 200
364 
365 #define XN_QVGA_X_RES 320
366 #define XN_QVGA_Y_RES 240
367 
368 #define XN_VGA_X_RES 640
369 #define XN_VGA_Y_RES 480
370 
371 #define XN_SVGA_X_RES 800
372 #define XN_SVGA_Y_RES 600
373 
374 #define XN_XGA_X_RES 1024
375 #define XN_XGA_Y_RES 768
376 
377 #define XN_720P_X_RES 1280
378 #define XN_720P_Y_RES 720
379 
380 #define XN_SXGA_X_RES 1280
381 #define XN_SXGA_Y_RES 1024
382 
383 #define XN_UXGA_X_RES 1600
384 #define XN_UXGA_Y_RES 1200
385 
386 #define XN_1080P_X_RES 1920
387 #define XN_1080P_Y_RES 1080
388 
389 #define XN_QCIF_X_RES 176
390 #define XN_QCIF_Y_RES 144
391 
392 #define XN_240P_X_RES 423
393 #define XN_240P_Y_RES 240
394 
395 #define XN_CIF_X_RES 352
396 #define XN_CIF_Y_RES 288
397 
398 #define XN_WVGA_X_RES 640
399 #define XN_WVGA_Y_RES 360
400 
401 #define XN_480P_X_RES 864
402 #define XN_480P_Y_RES 480
403 
404 #define XN_576P_X_RES 1024
405 #define XN_576P_Y_RES 576
406 
407 #define XN_DV_X_RES 960
408 #define XN_DV_Y_RES 720
409 
410 typedef enum XnResolution
411 {
429  XN_RES_DV = 17,
430 } XnResolution;
431 
435 typedef struct XnMapOutputMode
436 {
438  XnUInt32 nXRes;
440  XnUInt32 nYRes;
442  XnUInt32 nFPS;
444 
445 typedef enum XnSampleRate
446 {
456 } XnSampleRate;
457 
458 typedef struct XnWaveOutputMode
459 {
460  XnUInt32 nSampleRate;
461  XnUInt16 nBitsPerSample;
462  XnUInt8 nChannels;
464 
468 typedef struct XnVector3D
469 {
470  XnFloat X;
471  XnFloat Y;
472  XnFloat Z;
473 } XnVector3D;
474 
476 
480 typedef struct XnBoundingBox3D
481 {
485 
489 typedef struct XnCropping
490 {
492  XnBool bEnabled;
494  XnUInt16 nXOffset;
496  XnUInt16 nYOffset;
498  XnUInt16 nXSize;
500  XnUInt16 nYSize;
501 } XnCropping;
502 
506 typedef struct XnFieldOfView
507 {
509  XnDouble fHFOV;
511  XnDouble fVFOV;
512 } XnFieldOfView;
513 
514 typedef enum XnPixelFormat
515 {
521 } XnPixelFormat;
522 
524 {
525  XnBool m_bRGB24 : 1;
526  XnBool m_bYUV422 : 1;
527  XnBool m_bGrayscale8Bit : 1;
528  XnBool m_bGrayscale16Bit : 1;
529  XnBool m_bMJPEG : 1;
530  XnUInt m_nPadding : 3;
531  XnUInt m_nReserved : 24;
533 
534 typedef enum XnPlayerSeekOrigin
535 {
540 
542 {
547 
548 // User
549 typedef XnUInt32 XnUserID;
550 typedef XnFloat XnConfidence;
551 
553 typedef struct XnMatrix3X3
554 {
556  XnFloat elements[9];
557 } XnMatrix3X3;
558 
563 typedef struct XnPlane3D
564 {
567 
570 } XnPlane3D;
571 
577 {
580 
584 
593 {
599 
604 {
610 
614 typedef enum XnSkeletonJoint
615 {
620 
627 
634 
639 
645 
647 typedef enum XnSkeletonProfile
648 {
651 
654 
657 
660 
664 
667 {
675 
676 
679 {
686 {
700 
701 typedef enum XnDirection
702 {
710 } XnDirection;
711 
712 // User
720 typedef void (XN_CALLBACK_TYPE* XnUserHandler)(XnNodeHandle hNode, XnUserID user, void* pCookie);
721 
722 // Hands
732 typedef void (XN_CALLBACK_TYPE* XnHandCreate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
733 
743 typedef void (XN_CALLBACK_TYPE* XnHandUpdate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
744 
753 typedef void (XN_CALLBACK_TYPE* XnHandDestroy)(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie);
754 
765 typedef void (XN_CALLBACK_TYPE* XnHandTouchingFOVEdge)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie);
766 // Gesture Module
776 typedef void (XN_CALLBACK_TYPE* XnGestureRecognized)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
786 typedef void (XN_CALLBACK_TYPE* XnGestureProgress)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
787 
788 typedef void (XN_CALLBACK_TYPE* XnGestureIntermediateStageCompleted)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
789 typedef void (XN_CALLBACK_TYPE* XnGestureReadyForNextIntermediateStage)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
790 
791 // Skeleton
799 typedef void (XN_CALLBACK_TYPE* XnCalibrationStart)(XnNodeHandle hNode, XnUserID user, void* pCookie);
808 typedef void (XN_CALLBACK_TYPE* XnCalibrationEnd)(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie);
809 
810 typedef void (XN_CALLBACK_TYPE* XnCalibrationInProgress)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
811 typedef void (XN_CALLBACK_TYPE* XnCalibrationComplete)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
812 
813 // Pose Detection
822 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionCallback)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie);
823 
824 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionInProgress)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseDetectionError, void* pCookie);
825 
826 //---------------------------------------------------------------------------
827 // Recorder Types
828 //---------------------------------------------------------------------------
829 
835 typedef enum XnRecordMedium
836 {
840 
842 typedef XnUInt32 XnCodecID;
843 
845 #define XN_CODEC_ID(c1, c2, c3, c4) (XnCodecID)((c4 << 24) | (c3 << 16) | (c2 << 8) | c1)
846 
853 {
859  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
860 
869  XnStatus (XN_CALLBACK_TYPE* Write)(void* pCookie, const XnChar* strNodeName,
870  const void* pData, XnUInt32 nSize);
871 
879  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
880 
889  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
890 
896  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
897 
905  XnStatus (XN_CALLBACK_TYPE* Seek64)(void* pCookie, XnOSSeekType seekType, const XnInt64 nOffset);
906 
915  XnUInt64 (XN_CALLBACK_TYPE* Tell64)(void* pCookie);
916 
918 
925 {
931  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
932 
942  XnStatus (XN_CALLBACK_TYPE* Read)(void* pCookie, void* pBuffer, XnUInt32 nSize, XnUInt32* pnBytesRead);
943 
951  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
952 
960  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
961 
967  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
968 
976  XnStatus (XN_CALLBACK_TYPE* Seek64)(void* pCookie, XnOSSeekType seekType, const XnInt64 nOffset);
977 
986  XnUInt64 (XN_CALLBACK_TYPE* Tell64)(void* pCookie);
987 
989 
993 typedef struct XnNodeNotifications
994 {
1001  XnStatus (XN_CALLBACK_TYPE* OnNodeAdded)
1002  (void* pCookie, const XnChar* strNodeName, XnProductionNodeType type,
1003  XnCodecID compression);
1004 
1011  XnStatus (XN_CALLBACK_TYPE* OnNodeRemoved)
1012  (void* pCookie, const XnChar* strNodeName);
1013 
1022  XnStatus (XN_CALLBACK_TYPE* OnNodeIntPropChanged)
1023  (void* pCookie, const XnChar* strNodeName,
1024  const XnChar* strPropName, XnUInt64 nValue);
1025 
1034  XnStatus (XN_CALLBACK_TYPE* OnNodeRealPropChanged)
1035  (void* pCookie, const XnChar* strNodeName,
1036  const XnChar* strPropName, XnDouble dValue);
1037 
1046  XnStatus (XN_CALLBACK_TYPE* OnNodeStringPropChanged)
1047  (void* pCookie, const XnChar* strNodeName,
1048  const XnChar* strPropName, const XnChar* strValue);
1049 
1059  XnStatus (XN_CALLBACK_TYPE* OnNodeGeneralPropChanged)
1060  (void* pCookie, const XnChar* strNodeName,
1061  const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer);
1062 
1069  XnStatus (XN_CALLBACK_TYPE* OnNodeStateReady)
1070  (void* pCookie, const XnChar* strNodeName);
1071 
1081  XnStatus (XN_CALLBACK_TYPE* OnNodeNewData)
1082  (void* pCookie, const XnChar* strNodeName,
1083  XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize);
1084 
1086 
1088 typedef struct XnUInt32XYPair
1089 {
1090  XnUInt32 X;
1091  XnUInt32 Y;
1092 } XnUInt32XYPair;
1093 
1095 typedef struct XnOutputMetaData
1096 {
1098  XnUInt64 nTimestamp;
1099 
1101  XnUInt32 nFrameID;
1102 
1104  XnUInt32 nDataSize;
1105 
1107  XnBool bIsNew;
1108 
1110 
1112 typedef struct XnMapMetaData
1113 {
1116 
1119 
1122 
1125 
1128 
1130  XnUInt32 nFPS;
1131 } XnMapMetaData;
1132 
1134 typedef struct XnDepthMetaData
1135 {
1138 
1141 
1144 } XnDepthMetaData;
1145 
1147 typedef struct XnImageMetaData
1148 {
1151 
1153  const XnUInt8* pData;
1154 } XnImageMetaData;
1155 
1157 typedef struct XnIRMetaData
1158 {
1161 
1164 } XnIRMetaData;
1165 
1166 typedef struct XnAudioMetaData
1167 {
1170 
1173 
1175  const XnUInt8* pData;
1176 } XnAudioMetaData;
1177 
1178 typedef struct XnSceneMetaData
1179 {
1182 
1184  const XnLabel* pData;
1185 } XnSceneMetaData;
1186 
1187 #if XN_PLATFORM != XN_PLATFORM_ARC
1188 #pragma pack (pop)
1189 #endif
1190 
1191 #endif //__XN_TYPES_H__