OpenNI 1.5.4
XnTypes.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.x Alpha *
4 * Copyright (C) 2011 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * OpenNI is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published *
10 * by the Free Software Foundation, either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * OpenNI is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20 * *
21 ****************************************************************************/
22 #ifndef __XN_TYPES_H__
23 #define __XN_TYPES_H__
24 
25 //---------------------------------------------------------------------------
26 // Includes
27 //---------------------------------------------------------------------------
28 #include <XnStatus.h>
29 #include <XnOS.h>
30 
31 //---------------------------------------------------------------------------
32 // Defines
33 //---------------------------------------------------------------------------
35 #define XN_MAX_NAME_LENGTH 80
36 
38 #define XN_MAX_CREATION_INFO_LENGTH 255
39 
41 #define XN_MAX_LICENSE_LENGTH 255
42 
44 #define XN_NODE_WAIT_FOR_DATA_TIMEOUT 2000
45 
47 #define XN_VENDOR_OPEN_NI "OpenNI"
48 
50 #define XN_FORMAT_NAME_ONI "oni"
51 
53 #define XN_SCRIPT_FORMAT_XML "xml"
54 
56 #define XN_PLAYBACK_SPEED_FASTEST 0.0
57 
59 #define XN_AUTO_CONTROL XN_MIN_INT32
60 
61 //---------------------------------------------------------------------------
62 // Forward Declarations
63 //---------------------------------------------------------------------------
64 struct XnInternalNodeData;
65 
66 //---------------------------------------------------------------------------
67 // Types
68 //---------------------------------------------------------------------------
69 
70 #if XN_PLATFORM != XN_PLATFORM_ARC
71 #pragma pack (push, 1)
72 #endif
73 
77 typedef struct XnContext XnContext;
78 
82 typedef struct XnInternalNodeData* XnNodeHandle;
83 
87 typedef XnUInt32 XnLockHandle;
88 
92 typedef XnInt32 XnProductionNodeType;
93 
98 {
101 
104 
107 
110 
113 
116 
119 
122 
125 
128 
131 
134 
137 
143 
145 
147 
151 typedef struct XnVersion
152 {
153  XnUInt8 nMajor;
154  XnUInt8 nMinor;
155  XnUInt16 nMaintenance;
156  XnUInt32 nBuild;
157 } XnVersion;
158 
163 {
173 
177 typedef struct XnNodeInfo XnNodeInfo;
178 
183 
188 
193 {
196 
197 typedef struct XnNodeQuery XnNodeQuery;
198 
202 typedef struct XnLicense
203 {
208 } XnLicense;
209 
215 
219 typedef void* XnModuleNodeHandle;
220 
227 typedef void (XN_CALLBACK_TYPE* XnStateChangedHandler)(XnNodeHandle hNode, void* pCookie);
228 
235 typedef void (XN_CALLBACK_TYPE* XnErrorStateChangedHandler)(XnStatus errorState, void* pCookie);
236 
242 typedef void (XN_CALLBACK_TYPE* XnFreeHandler)(const void* pData);
243 
244 typedef void (XN_CALLBACK_TYPE* XnContextShuttingDownHandler)(XnContext* pContext, void* pCookie);
245 
256 typedef void (XN_CALLBACK_TYPE* XnNodeCreationHandler)(XnContext* pContext, XnNodeHandle hCreatedNode, void* pCookie);
257 
265 typedef void (XN_CALLBACK_TYPE* XnNodeDestructionHandler)(XnContext* pContext, const XnChar* strDestroyedNodeName, void* pCookie);
266 
268 typedef void* XnCallbackHandle;
269 
271 
272 //---------------------------------------------------------------------------
273 // 3D Vision Types
274 //---------------------------------------------------------------------------
276 typedef XnUInt16 XnDepthPixel;
277 
279 #define XN_DEPTH_NO_SAMPLE_VALUE ((XnDepthPixel)0)
280 
282 typedef struct XnRGB24Pixel
283 {
284  XnUInt8 nRed;
285  XnUInt8 nGreen;
286  XnUInt8 nBlue;
287 } XnRGB24Pixel;
288 
290 typedef struct XnYUV422DoublePixel
291 {
292  XnUInt8 nU;
293  XnUInt8 nY1;
294  XnUInt8 nV;
295  XnUInt8 nY2;
297 
299 typedef XnUInt8 XnGrayscale8Pixel;
300 
302 typedef XnUInt16 XnGrayscale16Pixel;
303 
306 
308 typedef XnUInt16 XnLabel;
309 
310 //---------------------------------------------------------------------------
311 // Generators Capabilities
312 //---------------------------------------------------------------------------
313 #define XN_CAPABILITY_EXTENDED_SERIALIZATION "ExtendedSerialization"
314 #define XN_CAPABILITY_MIRROR "Mirror"
315 #define XN_CAPABILITY_ALTERNATIVE_VIEW_POINT "AlternativeViewPoint"
316 #define XN_CAPABILITY_CROPPING "Cropping"
317 #define XN_CAPABILITY_USER_POSITION "UserPosition"
318 #define XN_CAPABILITY_SKELETON "User::Skeleton"
319 #define XN_CAPABILITY_POSE_DETECTION "User::PoseDetection"
320 #define XN_CAPABILITY_LOCK_AWARE "LockAware"
321 #define XN_CAPABILITY_ERROR_STATE "ErrorState"
322 #define XN_CAPABILITY_FRAME_SYNC "FrameSync"
323 #define XN_CAPABILITY_DEVICE_IDENTIFICATION "DeviceIdentification"
324 #define XN_CAPABILITY_BRIGHTNESS "Brightness"
325 #define XN_CAPABILITY_CONTRAST "Contrast"
326 #define XN_CAPABILITY_HUE "Hue"
327 #define XN_CAPABILITY_SATURATION "Saturation"
328 #define XN_CAPABILITY_SHARPNESS "Sharpness"
329 #define XN_CAPABILITY_GAMMA "Gamma"
330 #define XN_CAPABILITY_COLOR_TEMPERATURE "ColorTemperature"
331 #define XN_CAPABILITY_BACKLIGHT_COMPENSATION "BacklightCompensation"
332 #define XN_CAPABILITY_GAIN "Gain"
333 #define XN_CAPABILITY_PAN "Pan"
334 #define XN_CAPABILITY_TILT "Tilt"
335 #define XN_CAPABILITY_ROLL "Roll"
336 #define XN_CAPABILITY_ZOOM "Zoom"
337 #define XN_CAPABILITY_EXPOSURE "Exposure"
338 #define XN_CAPABILITY_IRIS "Iris"
339 #define XN_CAPABILITY_FOCUS "Focus"
340 #define XN_CAPABILITY_LOW_LIGHT_COMPENSATION "LowLightCompensation"
341 #define XN_CAPABILITY_ANTI_FLICKER "AntiFlicker"
342 #define XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE "Hands::HandTouchingFOVEdge"
343 
344 // Backwards compatibility - typo was fixed
345 #define XN_CAPABILITY_ANTI_FILCKER XN_CAPABILITY_ANTI_FLICKER
346 
347 // deprecated pragma is only supported in Visual Studio
348 #if (XN_PLATFORM == XN_PLATFORM_WIN32)
349 #pragma deprecated("XN_CAPABILITY_ANTI_FILCKER")
350 #endif
351 
352 //---------------------------------------------------------------------------
353 // Generators API Structs
354 //---------------------------------------------------------------------------
355 
356 #define XN_QQVGA_X_RES 160
357 #define XN_QQVGA_Y_RES 120
358 
359 #define XN_CGA_X_RES 320
360 #define XN_CGA_Y_RES 200
361 
362 #define XN_QVGA_X_RES 320
363 #define XN_QVGA_Y_RES 240
364 
365 #define XN_VGA_X_RES 640
366 #define XN_VGA_Y_RES 480
367 
368 #define XN_SVGA_X_RES 800
369 #define XN_SVGA_Y_RES 600
370 
371 #define XN_XGA_X_RES 1024
372 #define XN_XGA_Y_RES 768
373 
374 #define XN_720P_X_RES 1280
375 #define XN_720P_Y_RES 720
376 
377 #define XN_SXGA_X_RES 1280
378 #define XN_SXGA_Y_RES 1024
379 
380 #define XN_UXGA_X_RES 1600
381 #define XN_UXGA_Y_RES 1200
382 
383 #define XN_1080P_X_RES 1920
384 #define XN_1080P_Y_RES 1080
385 
386 #define XN_QCIF_X_RES 176
387 #define XN_QCIF_Y_RES 144
388 
389 #define XN_240P_X_RES 423
390 #define XN_240P_Y_RES 240
391 
392 #define XN_CIF_X_RES 352
393 #define XN_CIF_Y_RES 288
394 
395 #define XN_WVGA_X_RES 640
396 #define XN_WVGA_Y_RES 360
397 
398 #define XN_480P_X_RES 864
399 #define XN_480P_Y_RES 480
400 
401 #define XN_576P_X_RES 1024
402 #define XN_576P_Y_RES 576
403 
404 #define XN_DV_X_RES 960
405 #define XN_DV_Y_RES 720
406 
407 typedef enum XnResolution
408 {
426  XN_RES_DV = 17,
427 } XnResolution;
428 
432 typedef struct XnMapOutputMode
433 {
435  XnUInt32 nXRes;
437  XnUInt32 nYRes;
439  XnUInt32 nFPS;
441 
442 typedef enum XnSampleRate
443 {
453 } XnSampleRate;
454 
455 typedef struct XnWaveOutputMode
456 {
457  XnUInt32 nSampleRate;
458  XnUInt16 nBitsPerSample;
459  XnUInt8 nChannels;
461 
465 typedef struct XnVector3D
466 {
467  XnFloat X;
468  XnFloat Y;
469  XnFloat Z;
470 } XnVector3D;
471 
473 
477 typedef struct XnBoundingBox3D
478 {
482 
486 typedef struct XnCropping
487 {
489  XnBool bEnabled;
491  XnUInt16 nXOffset;
493  XnUInt16 nYOffset;
495  XnUInt16 nXSize;
497  XnUInt16 nYSize;
498 } XnCropping;
499 
503 typedef struct XnFieldOfView
504 {
506  XnDouble fHFOV;
508  XnDouble fVFOV;
509 } XnFieldOfView;
510 
511 typedef enum XnPixelFormat
512 {
518 } XnPixelFormat;
519 
521 {
522  XnBool m_bRGB24 : 1;
523  XnBool m_bYUV422 : 1;
524  XnBool m_bGrayscale8Bit : 1;
525  XnBool m_bGrayscale16Bit : 1;
526  XnBool m_bMJPEG : 1;
527  XnUInt m_nPadding : 3;
528  XnUInt m_nReserved : 24;
530 
531 typedef enum XnPlayerSeekOrigin
532 {
537 
539 {
544 
545 // User
546 typedef XnUInt32 XnUserID;
547 typedef XnFloat XnConfidence;
548 
550 typedef struct XnMatrix3X3
551 {
553  XnFloat elements[9];
554 } XnMatrix3X3;
555 
560 typedef struct XnPlane3D
561 {
564 
567 } XnPlane3D;
568 
574 {
577 
581 
590 {
596 
601 {
607 
611 typedef enum XnSkeletonJoint
612 {
617 
624 
631 
636 
642 
644 typedef enum XnSkeletonProfile
645 {
648 
651 
654 
657 
661 
664 {
672 
673 
676 {
683 {
697 
698 typedef enum XnDirection
699 {
707 } XnDirection;
708 
709 // User
717 typedef void (XN_CALLBACK_TYPE* XnUserHandler)(XnNodeHandle hNode, XnUserID user, void* pCookie);
718 
719 // Hands
729 typedef void (XN_CALLBACK_TYPE* XnHandCreate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
730 
740 typedef void (XN_CALLBACK_TYPE* XnHandUpdate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
741 
750 typedef void (XN_CALLBACK_TYPE* XnHandDestroy)(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie);
751 
762 typedef void (XN_CALLBACK_TYPE* XnHandTouchingFOVEdge)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie);
763 // Gesture Module
773 typedef void (XN_CALLBACK_TYPE* XnGestureRecognized)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
783 typedef void (XN_CALLBACK_TYPE* XnGestureProgress)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
784 
785 typedef void (XN_CALLBACK_TYPE* XnGestureIntermediateStageCompleted)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
786 typedef void (XN_CALLBACK_TYPE* XnGestureReadyForNextIntermediateStage)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
787 
788 // Skeleton
796 typedef void (XN_CALLBACK_TYPE* XnCalibrationStart)(XnNodeHandle hNode, XnUserID user, void* pCookie);
805 typedef void (XN_CALLBACK_TYPE* XnCalibrationEnd)(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie);
806 
807 typedef void (XN_CALLBACK_TYPE* XnCalibrationInProgress)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
808 typedef void (XN_CALLBACK_TYPE* XnCalibrationComplete)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
809 
810 // Pose Detection
819 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionCallback)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie);
820 
821 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionInProgress)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseDetectionError, void* pCookie);
822 
823 //---------------------------------------------------------------------------
824 // Recorder Types
825 //---------------------------------------------------------------------------
826 
832 typedef enum XnRecordMedium
833 {
837 
839 typedef XnUInt32 XnCodecID;
840 
842 #define XN_CODEC_ID(c1, c2, c3, c4) (XnCodecID)((c4 << 24) | (c3 << 16) | (c2 << 8) | c1)
843 
850 {
856  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
857 
866  XnStatus (XN_CALLBACK_TYPE* Write)(void* pCookie, const XnChar* strNodeName,
867  const void* pData, XnUInt32 nSize);
868 
876  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
877 
886  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
887 
893  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
894 
902  XnStatus (XN_CALLBACK_TYPE* Seek64)(void* pCookie, XnOSSeekType seekType, const XnInt64 nOffset);
903 
912  XnUInt64 (XN_CALLBACK_TYPE* Tell64)(void* pCookie);
913 
915 
922 {
928  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
929 
939  XnStatus (XN_CALLBACK_TYPE* Read)(void* pCookie, void* pBuffer, XnUInt32 nSize, XnUInt32* pnBytesRead);
940 
948  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
949 
957  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
958 
964  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
965 
973  XnStatus (XN_CALLBACK_TYPE* Seek64)(void* pCookie, XnOSSeekType seekType, const XnInt64 nOffset);
974 
983  XnUInt64 (XN_CALLBACK_TYPE* Tell64)(void* pCookie);
984 
986 
990 typedef struct XnNodeNotifications
991 {
998  XnStatus (XN_CALLBACK_TYPE* OnNodeAdded)
999  (void* pCookie, const XnChar* strNodeName, XnProductionNodeType type,
1000  XnCodecID compression);
1001 
1008  XnStatus (XN_CALLBACK_TYPE* OnNodeRemoved)
1009  (void* pCookie, const XnChar* strNodeName);
1010 
1019  XnStatus (XN_CALLBACK_TYPE* OnNodeIntPropChanged)
1020  (void* pCookie, const XnChar* strNodeName,
1021  const XnChar* strPropName, XnUInt64 nValue);
1022 
1031  XnStatus (XN_CALLBACK_TYPE* OnNodeRealPropChanged)
1032  (void* pCookie, const XnChar* strNodeName,
1033  const XnChar* strPropName, XnDouble dValue);
1034 
1043  XnStatus (XN_CALLBACK_TYPE* OnNodeStringPropChanged)
1044  (void* pCookie, const XnChar* strNodeName,
1045  const XnChar* strPropName, const XnChar* strValue);
1046 
1056  XnStatus (XN_CALLBACK_TYPE* OnNodeGeneralPropChanged)
1057  (void* pCookie, const XnChar* strNodeName,
1058  const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer);
1059 
1066  XnStatus (XN_CALLBACK_TYPE* OnNodeStateReady)
1067  (void* pCookie, const XnChar* strNodeName);
1068 
1078  XnStatus (XN_CALLBACK_TYPE* OnNodeNewData)
1079  (void* pCookie, const XnChar* strNodeName,
1080  XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize);
1081 
1083 
1085 typedef struct XnUInt32XYPair
1086 {
1087  XnUInt32 X;
1088  XnUInt32 Y;
1089 } XnUInt32XYPair;
1090 
1092 typedef struct XnOutputMetaData
1093 {
1095  XnUInt64 nTimestamp;
1096 
1098  XnUInt32 nFrameID;
1099 
1101  XnUInt32 nDataSize;
1102 
1104  XnBool bIsNew;
1105 
1107 
1109 typedef struct XnMapMetaData
1110 {
1113 
1116 
1119 
1122 
1125 
1127  XnUInt32 nFPS;
1128 } XnMapMetaData;
1129 
1131 typedef struct XnDepthMetaData
1132 {
1135 
1138 
1141 } XnDepthMetaData;
1142 
1144 typedef struct XnImageMetaData
1145 {
1148 
1150  const XnUInt8* pData;
1151 } XnImageMetaData;
1152 
1154 typedef struct XnIRMetaData
1155 {
1158 
1161 } XnIRMetaData;
1162 
1163 typedef struct XnAudioMetaData
1164 {
1167 
1170 
1172  const XnUInt8* pData;
1173 } XnAudioMetaData;
1174 
1175 typedef struct XnSceneMetaData
1176 {
1179 
1181  const XnLabel* pData;
1182 } XnSceneMetaData;
1183 
1184 #if XN_PLATFORM != XN_PLATFORM_ARC
1185 #pragma pack (pop)
1186 #endif
1187 
1188 #endif //__XN_TYPES_H__