OpenNI 1.3.2
XnTypes.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.1 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 
247 typedef void* XnCallbackHandle;
248 
250 
251 //---------------------------------------------------------------------------
252 // 3D Vision Types
253 //---------------------------------------------------------------------------
255 typedef XnUInt16 XnDepthPixel;
256 
258 #define XN_DEPTH_NO_SAMPLE_VALUE ((XnDepthPixel)0)
259 
261 typedef struct XnRGB24Pixel
262 {
263  XnUInt8 nRed;
264  XnUInt8 nGreen;
265  XnUInt8 nBlue;
266 } XnRGB24Pixel;
267 
269 typedef struct XnYUV422DoublePixel
270 {
271  XnUInt8 nU;
272  XnUInt8 nY1;
273  XnUInt8 nV;
274  XnUInt8 nY2;
276 
278 typedef XnUInt8 XnGrayscale8Pixel;
279 
281 typedef XnUInt16 XnGrayscale16Pixel;
282 
285 
287 typedef XnUInt16 XnLabel;
288 
289 //---------------------------------------------------------------------------
290 // Generators Capabilities
291 //---------------------------------------------------------------------------
292 #define XN_CAPABILITY_EXTENDED_SERIALIZATION "ExtendedSerialization"
293 #define XN_CAPABILITY_MIRROR "Mirror"
294 #define XN_CAPABILITY_ALTERNATIVE_VIEW_POINT "AlternativeViewPoint"
295 #define XN_CAPABILITY_CROPPING "Cropping"
296 #define XN_CAPABILITY_USER_POSITION "UserPosition"
297 #define XN_CAPABILITY_SKELETON "User::Skeleton"
298 #define XN_CAPABILITY_POSE_DETECTION "User::PoseDetection"
299 #define XN_CAPABILITY_LOCK_AWARE "LockAware"
300 #define XN_CAPABILITY_ERROR_STATE "ErrorState"
301 #define XN_CAPABILITY_FRAME_SYNC "FrameSync"
302 #define XN_CAPABILITY_DEVICE_IDENTIFICATION "DeviceIdentification"
303 #define XN_CAPABILITY_BRIGHTNESS "Brightness"
304 #define XN_CAPABILITY_CONTRAST "Contrast"
305 #define XN_CAPABILITY_HUE "Hue"
306 #define XN_CAPABILITY_SATURATION "Saturation"
307 #define XN_CAPABILITY_SHARPNESS "Sharpness"
308 #define XN_CAPABILITY_GAMMA "Gamma"
309 #define XN_CAPABILITY_COLOR_TEMPERATURE "ColorTemperature"
310 #define XN_CAPABILITY_BACKLIGHT_COMPENSATION "BacklightCompensation"
311 #define XN_CAPABILITY_GAIN "Gain"
312 #define XN_CAPABILITY_PAN "Pan"
313 #define XN_CAPABILITY_TILT "Tilt"
314 #define XN_CAPABILITY_ROLL "Roll"
315 #define XN_CAPABILITY_ZOOM "Zoom"
316 #define XN_CAPABILITY_EXPOSURE "Exposure"
317 #define XN_CAPABILITY_IRIS "Iris"
318 #define XN_CAPABILITY_FOCUS "Focus"
319 #define XN_CAPABILITY_LOW_LIGHT_COMPENSATION "LowLightCompensation"
320 #define XN_CAPABILITY_ANTI_FLICKER "AntiFlicker"
321 #define XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE "Hands::HandTouchingFOVEdge"
322 
323 // Backwards compatibility - typo was fixed
324 #define XN_CAPABILITY_ANTI_FILCKER XN_CAPABILITY_ANTI_FLICKER
325 
326 // deprecated pragma is only supported in Visual Studio
327 #if (XN_PLATFORM == XN_PLATFORM_WIN32)
328 //#pragma deprecated("XN_CAPABILITY_ANTI_FILCKER")
329 #endif
330 
331 //---------------------------------------------------------------------------
332 // Generators API Structs
333 //---------------------------------------------------------------------------
334 
335 #define XN_QQVGA_X_RES 160
336 #define XN_QQVGA_Y_RES 120
337 
338 #define XN_CGA_X_RES 320
339 #define XN_CGA_Y_RES 200
340 
341 #define XN_QVGA_X_RES 320
342 #define XN_QVGA_Y_RES 240
343 
344 #define XN_VGA_X_RES 640
345 #define XN_VGA_Y_RES 480
346 
347 #define XN_SVGA_X_RES 800
348 #define XN_SVGA_Y_RES 600
349 
350 #define XN_XGA_X_RES 1024
351 #define XN_XGA_Y_RES 768
352 
353 #define XN_720P_X_RES 1280
354 #define XN_720P_Y_RES 720
355 
356 #define XN_SXGA_X_RES 1280
357 #define XN_SXGA_Y_RES 1024
358 
359 #define XN_UXGA_X_RES 1600
360 #define XN_UXGA_Y_RES 1200
361 
362 #define XN_1080P_X_RES 1920
363 #define XN_1080P_Y_RES 1080
364 
365 #define XN_QCIF_X_RES 176
366 #define XN_QCIF_Y_RES 144
367 
368 #define XN_240P_X_RES 423
369 #define XN_240P_Y_RES 240
370 
371 #define XN_CIF_X_RES 352
372 #define XN_CIF_Y_RES 288
373 
374 #define XN_WVGA_X_RES 640
375 #define XN_WVGA_Y_RES 360
376 
377 #define XN_480P_X_RES 864
378 #define XN_480P_Y_RES 480
379 
380 #define XN_576P_X_RES 1024
381 #define XN_576P_Y_RES 576
382 
383 #define XN_DV_X_RES 960
384 #define XN_DV_Y_RES 720
385 
386 typedef enum XnResolution
387 {
405  XN_RES_DV = 17,
406 } XnResolution;
407 
411 typedef struct XnMapOutputMode
412 {
414  XnUInt32 nXRes;
416  XnUInt32 nYRes;
418  XnUInt32 nFPS;
420 
421 typedef enum XnSampleRate
422 {
432 } XnSampleRate;
433 
434 typedef struct XnWaveOutputMode
435 {
436  XnUInt32 nSampleRate;
437  XnUInt16 nBitsPerSample;
438  XnUInt8 nChannels;
440 
444 typedef struct XnVector3D
445 {
446  XnFloat X;
447  XnFloat Y;
448  XnFloat Z;
449 } XnVector3D;
450 
452 
456 typedef struct XnBoundingBox3D
457 {
461 
465 typedef struct XnCropping
466 {
468  XnBool bEnabled;
470  XnUInt16 nXOffset;
472  XnUInt16 nYOffset;
474  XnUInt16 nXSize;
476  XnUInt16 nYSize;
477 } XnCropping;
478 
482 typedef struct XnFieldOfView
483 {
485  XnDouble fHFOV;
487  XnDouble fVFOV;
488 } XnFieldOfView;
489 
490 typedef enum XnPixelFormat
491 {
497 } XnPixelFormat;
498 
500 {
501  XnBool m_bRGB24 : 1;
502  XnBool m_bYUV422 : 1;
503  XnBool m_bGrayscale8Bit : 1;
504  XnBool m_bGrayscale16Bit : 1;
505  XnBool m_bMJPEG : 1;
506  XnUInt m_nPadding : 3;
507  XnUInt m_nReserved : 24;
509 
510 typedef enum XnPlayerSeekOrigin
511 {
516 
518 {
523 
524 // User
525 typedef XnUInt32 XnUserID;
526 typedef XnFloat XnConfidence;
527 
529 typedef struct XnMatrix3X3
530 {
532  XnFloat elements[9];
533 } XnMatrix3X3;
534 
539 typedef struct XnPlane3D
540 {
543 
546 } XnPlane3D;
547 
553 {
556 
560 
569 {
575 
580 {
586 
590 typedef enum XnSkeletonJoint
591 {
596 
603 
610 
615 
621 
623 typedef enum XnSkeletonProfile
624 {
627 
630 
633 
636 
640 
643 {
650 
653 {
664 
665 typedef enum XnDirection
666 {
674 } XnDirection;
675 
676 // User
684 typedef void (XN_CALLBACK_TYPE* XnUserHandler)(XnNodeHandle hNode, XnUserID user, void* pCookie);
685 
686 // Hands
696 typedef void (XN_CALLBACK_TYPE* XnHandCreate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
697 
707 typedef void (XN_CALLBACK_TYPE* XnHandUpdate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
708 
717 typedef void (XN_CALLBACK_TYPE* XnHandDestroy)(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie);
718 
729 typedef void (XN_CALLBACK_TYPE* XnHandTouchingFOVEdge)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie);
730 // Gesture Module
740 typedef void (XN_CALLBACK_TYPE* XnGestureRecognized)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
750 typedef void (XN_CALLBACK_TYPE* XnGestureProgress)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
751 
752 typedef void (XN_CALLBACK_TYPE* XnGestureIntermediateStageCompleted)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
753 typedef void (XN_CALLBACK_TYPE* XnGestureReadyForNextIntermediateStage)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
754 
755 // Skeleton
763 typedef void (XN_CALLBACK_TYPE* XnCalibrationStart)(XnNodeHandle hNode, XnUserID user, void* pCookie);
772 typedef void (XN_CALLBACK_TYPE* XnCalibrationEnd)(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie);
773 
774 typedef void (XN_CALLBACK_TYPE* XnCalibrationInProgress)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
775 typedef void (XN_CALLBACK_TYPE* XnCalibrationComplete)(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
776 
777 // Pose Detection
786 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionCallback)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie);
787 
788 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionInProgress)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseDetectionError, void* pCookie);
789 
790 //---------------------------------------------------------------------------
791 // Recorder Types
792 //---------------------------------------------------------------------------
793 
799 typedef enum XnRecordMedium
800 {
804 
806 typedef XnUInt32 XnCodecID;
807 
809 #define XN_CODEC_ID(c1, c2, c3, c4) (XnCodecID)((c4 << 24) | (c3 << 16) | (c2 << 8) | c1)
810 
817 {
823  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
824 
833  XnStatus (XN_CALLBACK_TYPE* Write)(void* pCookie, const XnChar* strNodeName,
834  const void* pData, XnUInt32 nSize);
835 
843  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnUInt32 nOffset);
844 
853  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
854 
860  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
862 
869 {
875  XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie);
876 
886  XnStatus (XN_CALLBACK_TYPE* Read)(void* pCookie, void* pBuffer, XnUInt32 nSize, XnUInt32* pnBytesRead);
887 
895  XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset);
896 
904  XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie);
905 
911  void (XN_CALLBACK_TYPE* Close)(void* pCookie);
913 
917 typedef struct XnNodeNotifications
918 {
925  XnStatus (XN_CALLBACK_TYPE* OnNodeAdded)
926  (void* pCookie, const XnChar* strNodeName, XnProductionNodeType type,
927  XnCodecID compression);
928 
935  XnStatus (XN_CALLBACK_TYPE* OnNodeRemoved)
936  (void* pCookie, const XnChar* strNodeName);
937 
946  XnStatus (XN_CALLBACK_TYPE* OnNodeIntPropChanged)
947  (void* pCookie, const XnChar* strNodeName,
948  const XnChar* strPropName, XnUInt64 nValue);
949 
958  XnStatus (XN_CALLBACK_TYPE* OnNodeRealPropChanged)
959  (void* pCookie, const XnChar* strNodeName,
960  const XnChar* strPropName, XnDouble dValue);
961 
970  XnStatus (XN_CALLBACK_TYPE* OnNodeStringPropChanged)
971  (void* pCookie, const XnChar* strNodeName,
972  const XnChar* strPropName, const XnChar* strValue);
973 
983  XnStatus (XN_CALLBACK_TYPE* OnNodeGeneralPropChanged)
984  (void* pCookie, const XnChar* strNodeName,
985  const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer);
986 
993  XnStatus (XN_CALLBACK_TYPE* OnNodeStateReady)
994  (void* pCookie, const XnChar* strNodeName);
995 
1005  XnStatus (XN_CALLBACK_TYPE* OnNodeNewData)
1006  (void* pCookie, const XnChar* strNodeName,
1007  XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize);
1008 
1010 
1012 typedef struct XnUInt32XYPair
1013 {
1014  XnUInt32 X;
1015  XnUInt32 Y;
1016 } XnUInt32XYPair;
1017 
1019 typedef struct XnOutputMetaData
1020 {
1022  XnUInt64 nTimestamp;
1023 
1025  XnUInt32 nFrameID;
1026 
1028  XnUInt32 nDataSize;
1029 
1031  XnBool bIsNew;
1032 
1034 
1036 typedef struct XnMapMetaData
1037 {
1040 
1043 
1046 
1049 
1052 
1054  XnUInt32 nFPS;
1055 } XnMapMetaData;
1056 
1058 typedef struct XnDepthMetaData
1059 {
1062 
1065 
1068 } XnDepthMetaData;
1069 
1071 typedef struct XnImageMetaData
1072 {
1075 
1077  const XnUInt8* pData;
1078 } XnImageMetaData;
1079 
1081 typedef struct XnIRMetaData
1082 {
1085 
1088 } XnIRMetaData;
1089 
1090 typedef struct XnAudioMetaData
1091 {
1094 
1097 
1099  const XnUInt8* pData;
1100 } XnAudioMetaData;
1101 
1102 typedef struct XnSceneMetaData
1103 {
1106 
1108  const XnLabel* pData;
1109 } XnSceneMetaData;
1110 
1111 #if XN_PLATFORM != XN_PLATFORM_ARC
1112 #pragma pack (pop)
1113 #endif
1114 
1115 #endif //__XN_TYPES_H__