OpenNI 1.0.0
|
00001 /***************************************************************************** 00002 * * 00003 * OpenNI 1.0 Alpha * 00004 * Copyright (C) 2010 PrimeSense Ltd. * 00005 * * 00006 * This file is part of OpenNI. * 00007 * * 00008 * OpenNI is free software: you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published * 00010 * by the Free Software Foundation, either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * OpenNI is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. * 00020 * * 00021 *****************************************************************************/ 00022 00023 00024 00025 #ifndef __XN_TYPES_H__ 00026 #define __XN_TYPES_H__ 00027 00028 //--------------------------------------------------------------------------- 00029 // Includes 00030 //--------------------------------------------------------------------------- 00031 #include <XnStatus.h> 00032 #include <XnOS.h> 00033 00034 //--------------------------------------------------------------------------- 00035 // Defines 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 00056 #define XN_PLAYBACK_SPEED_FASTEST 0.0 00057 00058 //--------------------------------------------------------------------------- 00059 // Forward Declarations 00060 //--------------------------------------------------------------------------- 00061 struct XnInternalNodeData; 00062 00063 //--------------------------------------------------------------------------- 00064 // Types 00065 //--------------------------------------------------------------------------- 00066 00067 #pragma pack (push, 1) 00068 00072 typedef struct XnContext XnContext; 00073 00077 typedef struct XnInternalNodeData* XnNodeHandle; 00078 00082 typedef XnUInt32 XnLockHandle; 00083 00087 typedef enum XnProductionNodeType 00088 { 00090 XN_NODE_TYPE_DEVICE = 1, 00091 00093 XN_NODE_TYPE_DEPTH = 2, 00094 00096 XN_NODE_TYPE_IMAGE = 3, 00097 00099 XN_NODE_TYPE_AUDIO = 4, 00100 00102 XN_NODE_TYPE_IR = 5, 00103 00105 XN_NODE_TYPE_USER = 6, 00106 00108 XN_NODE_TYPE_RECORDER = 7, 00109 00111 XN_NODE_TYPE_PLAYER = 8, 00112 00114 XN_NODE_TYPE_GESTURE = 9, 00115 00117 XN_NODE_TYPE_SCENE = 10, 00118 00120 XN_NODE_TYPE_HANDS = 11, 00121 00123 XN_NODE_TYPE_CODEC = 12, 00124 } XnProductionNodeType; 00125 00129 typedef struct XnVersion 00130 { 00131 XnUInt8 nMajor; 00132 XnUInt8 nMinor; 00133 XnUInt16 nMaintenance; 00134 XnUInt32 nBuild; 00135 } XnVersion; 00136 00140 typedef struct XnProductionNodeDescription 00141 { 00143 XnProductionNodeType Type; 00145 XnChar strVendor[XN_MAX_NAME_LENGTH]; 00147 XnChar strName[XN_MAX_NAME_LENGTH]; 00149 XnVersion Version; 00150 } XnProductionNodeDescription; 00151 00155 typedef struct XnNodeInfo XnNodeInfo; 00156 00160 typedef struct XnNodeInfoListNode XnNodeInfoListNode; 00161 00165 typedef struct XnNodeInfoList XnNodeInfoList; 00166 00170 typedef struct XnNodeInfoListIterator 00171 { 00172 XnNodeInfoListNode* pCurrent; 00173 } XnNodeInfoListIterator; 00174 00175 typedef struct XnNodeQuery XnNodeQuery; 00176 00180 typedef struct XnLicense 00181 { 00183 XnChar strVendor[XN_MAX_NAME_LENGTH]; 00185 XnChar strKey[XN_MAX_LICENSE_LENGTH]; 00186 } XnLicense; 00187 00192 typedef struct XnEnumerationErrors XnEnumerationErrors; 00193 00197 typedef void* XnModuleNodeHandle; 00198 00205 typedef void (XN_CALLBACK_TYPE* XnStateChangedHandler)(XnNodeHandle hNode, void* pCookie); 00206 00213 typedef void (XN_CALLBACK_TYPE* XnErrorStateChangedHandler)(XnStatus errorState, void* pCookie); 00214 00216 typedef void* XnCallbackHandle; 00217 00218 typedef struct XnModuleExportedProductionNodeInterface XnModuleExportedProductionNodeInterface; // Forward Declaration 00219 00220 00221 //--------------------------------------------------------------------------- 00222 // 3D Vision Types 00223 //--------------------------------------------------------------------------- 00225 typedef XnUInt16 XnDepthPixel; 00226 00228 #define XN_DEPTH_NO_SAMPLE_VALUE ((XnDepthPixel)0) 00229 00231 typedef struct XnRGB24Pixel 00232 { 00233 XnUInt8 nRed; 00234 XnUInt8 nGreen; 00235 XnUInt8 nBlue; 00236 } XnRGB24Pixel; 00237 00239 typedef struct XnYUV422DoublePixel 00240 { 00241 XnUInt8 nU; 00242 XnUInt8 nY1; 00243 XnUInt8 nV; 00244 XnUInt8 nY2; 00245 } XnYUV422DoublePixel; 00246 00248 typedef XnUInt8 XnGrayscale8Pixel; 00249 00251 typedef XnUInt16 XnGrayscale16Pixel; 00252 00254 typedef XnGrayscale16Pixel XnIRPixel; 00255 00257 typedef XnUInt16 XnLabel; 00258 00259 //--------------------------------------------------------------------------- 00260 // Generators Capabilities 00261 //--------------------------------------------------------------------------- 00262 #define XN_CAPABILITY_EXTENDED_SERIALIZATION "ExtendedSerialization" 00263 #define XN_CAPABILITY_MIRROR "Mirror" 00264 #define XN_CAPABILITY_ALTERNATIVE_VIEW_POINT "AlternativeViewPoint" 00265 #define XN_CAPABILITY_CROPPING "Cropping" 00266 #define XN_CAPABILITY_USER_POSITION "UserPosition" 00267 #define XN_CAPABILITY_SKELETON "User::Skeleton" 00268 #define XN_CAPABILITY_POSE_DETECTION "User::PoseDetection" 00269 #define XN_CAPABILITY_LOCK_AWARE "LockAware" 00270 #define XN_CAPABILITY_ERROR_STATE "ErrorState" 00271 #define XN_CAPABILITY_FRAME_SYNC "FrameSync" 00272 00273 //--------------------------------------------------------------------------- 00274 // Generators API Structs 00275 //--------------------------------------------------------------------------- 00276 00277 #define XN_QQVGA_X_RES 160 00278 #define XN_QQVGA_Y_RES 120 00279 00280 #define XN_CGA_X_RES 320 00281 #define XN_CGA_Y_RES 200 00282 00283 #define XN_QVGA_X_RES 320 00284 #define XN_QVGA_Y_RES 240 00285 00286 #define XN_VGA_X_RES 640 00287 #define XN_VGA_Y_RES 480 00288 00289 #define XN_SVGA_X_RES 800 00290 #define XN_SVGA_Y_RES 600 00291 00292 #define XN_XGA_X_RES 1024 00293 #define XN_XGA_Y_RES 768 00294 00295 #define XN_720P_X_RES 1280 00296 #define XN_720P_Y_RES 720 00297 00298 #define XN_SXGA_X_RES 1280 00299 #define XN_SXGA_Y_RES 1024 00300 00301 #define XN_UXGA_X_RES 1600 00302 #define XN_UXGA_Y_RES 1200 00303 00304 #define XN_1080P_X_RES 1920 00305 #define XN_1080P_Y_RES 1080 00306 00307 typedef enum XnResolution 00308 { 00309 XN_RES_CUSTOM = 0, 00310 XN_RES_QQVGA = 1, 00311 XN_RES_CGA = 2, 00312 XN_RES_QVGA = 3, 00313 XN_RES_VGA = 4, 00314 XN_RES_SVGA = 5, 00315 XN_RES_XGA = 6, 00316 XN_RES_720P = 7, 00317 XN_RES_SXGA = 8, 00318 XN_RES_UXGA = 9, 00319 XN_RES_1080P = 10, 00320 } XnResolution; 00321 00325 typedef struct XnMapOutputMode 00326 { 00328 XnUInt32 nXRes; 00330 XnUInt32 nYRes; 00332 XnUInt32 nFPS; 00333 } XnMapOutputMode; 00334 00335 typedef enum XnSampleRate 00336 { 00337 XN_SAMPLE_RATE_8K = 8000, 00338 XN_SAMPLE_RATE_11K = 11025, 00339 XN_SAMPLE_RATE_12K = 12000, 00340 XN_SAMPLE_RATE_16K = 16000, 00341 XN_SAMPLE_RATE_22K = 22050, 00342 XN_SAMPLE_RATE_24K = 24000, 00343 XN_SAMPLE_RATE_32K = 32000, 00344 XN_SAMPLE_RATE_44K = 44100, 00345 XN_SAMPLE_RATE_48K = 48000, 00346 } XnSampleRate; 00347 00348 typedef struct XnWaveOutputMode 00349 { 00350 XnUInt32 nSampleRate; 00351 XnUInt16 nBitsPerSample; 00352 XnUInt8 nChannels; 00353 } XnWaveOutputMode; 00354 00358 typedef struct XnVector3D 00359 { 00360 XnFloat X; 00361 XnFloat Y; 00362 XnFloat Z; 00363 } XnVector3D; 00364 00365 typedef XnVector3D XnPoint3D; 00366 00370 typedef struct XnBoundingBox3D 00371 { 00372 XnPoint3D LeftBottomNear; 00373 XnPoint3D RightTopFar; 00374 } XnBoundingBox3D; 00375 00379 typedef struct XnCropping 00380 { 00382 XnBool bEnabled; 00384 XnUInt16 nXOffset; 00386 XnUInt16 nYOffset; 00388 XnUInt16 nXSize; 00390 XnUInt16 nYSize; 00391 } XnCropping; 00392 00396 typedef struct XnFieldOfView 00397 { 00399 XnDouble fHFOV; 00401 XnDouble fVFOV; 00402 } XnFieldOfView; 00403 00404 typedef enum XnPixelFormat 00405 { 00406 XN_PIXEL_FORMAT_RGB24 = 1, 00407 XN_PIXEL_FORMAT_YUV422 = 2, 00408 XN_PIXEL_FORMAT_GRAYSCALE_8_BIT = 3, 00409 XN_PIXEL_FORMAT_GRAYSCALE_16_BIT = 4, 00410 } XnPixelFormat; 00411 00412 typedef struct XnSupportedPixelFormats 00413 { 00414 XnBool m_bRGB24 : 1; 00415 XnBool m_bYUV422 : 1; 00416 XnBool m_bGrayscale8Bit : 1; 00417 XnBool m_bGrayscale16Bit : 1; 00418 XnUInt m_nPadding : 4; 00419 XnUInt m_nReserved : 24; 00420 } XnSupportedPixelFormats; 00421 00422 typedef enum XnPlayerSeekOrigin 00423 { 00424 XN_PLAYER_SEEK_SET = 0, 00425 XN_PLAYER_SEEK_CUR = 1, 00426 XN_PLAYER_SEEK_END = 2, 00427 } XnPlayerSeekOrigin; 00428 00429 // User 00430 typedef XnUInt32 XnUserID; 00431 typedef XnFloat XnConfidence; 00432 00434 typedef struct XnMatrix3X3 00435 { 00437 XnFloat elements[9]; 00438 } XnMatrix3X3; 00439 00444 typedef struct XnPlane3D 00445 { 00447 XnVector3D vNormal; 00448 00450 XnPoint3D ptPoint; 00451 } XnPlane3D; 00452 00457 typedef struct XnSkeletonJointPosition 00458 { 00460 XnVector3D position; 00461 00463 XnConfidence fConfidence; 00464 } XnSkeletonJointPosition; 00465 00473 typedef struct XnSkeletonJointOrientation 00474 { 00476 XnMatrix3X3 orientation; 00478 XnConfidence fConfidence; 00479 } XnSkeletonJointOrientation; 00480 00484 typedef struct XnSkeletonJointTransformation 00485 { 00487 XnSkeletonJointPosition position; 00489 XnSkeletonJointOrientation orientation; 00490 } XnSkeletonJointTransformation; 00491 00495 typedef enum XnSkeletonJoint 00496 { 00497 XN_SKEL_HEAD = 1, 00498 XN_SKEL_NECK = 2, 00499 XN_SKEL_TORSO = 3, 00500 XN_SKEL_WAIST = 4, 00501 00502 XN_SKEL_LEFT_COLLAR = 5, 00503 XN_SKEL_LEFT_SHOULDER = 6, 00504 XN_SKEL_LEFT_ELBOW = 7, 00505 XN_SKEL_LEFT_WRIST = 8, 00506 XN_SKEL_LEFT_HAND = 9, 00507 XN_SKEL_LEFT_FINGERTIP =10, 00508 00509 XN_SKEL_RIGHT_COLLAR =11, 00510 XN_SKEL_RIGHT_SHOULDER =12, 00511 XN_SKEL_RIGHT_ELBOW =13, 00512 XN_SKEL_RIGHT_WRIST =14, 00513 XN_SKEL_RIGHT_HAND =15, 00514 XN_SKEL_RIGHT_FINGERTIP =16, 00515 00516 XN_SKEL_LEFT_HIP =17, 00517 XN_SKEL_LEFT_KNEE =18, 00518 XN_SKEL_LEFT_ANKLE =19, 00519 XN_SKEL_LEFT_FOOT =20, 00520 00521 XN_SKEL_RIGHT_HIP =21, 00522 XN_SKEL_RIGHT_KNEE =22, 00523 XN_SKEL_RIGHT_ANKLE =23, 00524 XN_SKEL_RIGHT_FOOT =24 00525 } XnSkeletonJoint; 00526 00528 typedef enum XnSkeletonProfile 00529 { 00531 XN_SKEL_PROFILE_NONE = 1, 00532 00534 XN_SKEL_PROFILE_ALL = 2, 00535 00537 XN_SKEL_PROFILE_UPPER = 3, 00538 00540 XN_SKEL_PROFILE_LOWER = 4, 00541 00543 XN_SKEL_PROFILE_HEAD_HANDS = 5, 00544 } XnSkeletonProfile; 00545 00546 // User 00554 typedef void (XN_CALLBACK_TYPE* XnUserHandler)(XnNodeHandle hNode, XnUserID user, void* pCookie); 00555 00556 // Hands 00566 typedef void (XN_CALLBACK_TYPE* XnHandCreate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie); 00567 00577 typedef void (XN_CALLBACK_TYPE* XnHandUpdate)(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie); 00578 00587 typedef void (XN_CALLBACK_TYPE* XnHandDestroy)(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie); 00588 00589 // Gesture Module 00599 typedef void (XN_CALLBACK_TYPE* XnGestureRecognized)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie); 00609 typedef void (XN_CALLBACK_TYPE* XnGestureProgress)(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie); 00610 00611 // Skeleton 00619 typedef void (XN_CALLBACK_TYPE* XnCalibrationStart)(XnNodeHandle hNode, XnUserID user, void* pCookie); 00628 typedef void (XN_CALLBACK_TYPE* XnCalibrationEnd)(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie); 00629 00630 // Pose Detection 00639 typedef void (XN_CALLBACK_TYPE* XnPoseDetectionCallback)(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie); 00640 00641 //--------------------------------------------------------------------------- 00642 // Recorder Types 00643 //--------------------------------------------------------------------------- 00644 00650 typedef enum XnRecordMedium 00651 { 00653 XN_RECORD_MEDIUM_FILE = 0, 00654 } XnRecordMedium; 00655 00657 typedef XnUInt32 XnCodecID; 00658 00660 #define XN_CODEC_ID(c1, c2, c3, c4) (XnCodecID)((c4 << 24) | (c3 << 16) | (c2 << 8) | c1) 00661 00667 typedef struct XnRecorderOutputStreamInterface 00668 { 00674 XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie); 00675 00684 XnStatus (XN_CALLBACK_TYPE* Write)(void* pCookie, const XnChar* strNodeName, 00685 const void* pData, XnUInt32 nSize); 00686 00694 XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnUInt32 nOffset); 00695 00704 XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie); 00705 00711 void (XN_CALLBACK_TYPE* Close)(void* pCookie); 00712 } XnRecorderOutputStreamInterface; 00713 00719 typedef struct XnPlayerInputStreamInterface 00720 { 00726 XnStatus (XN_CALLBACK_TYPE* Open)(void* pCookie); 00727 00737 XnStatus (XN_CALLBACK_TYPE* Read)(void* pCookie, void* pBuffer, XnUInt32 nSize, XnUInt32* pnBytesRead); 00738 00746 XnStatus (XN_CALLBACK_TYPE* Seek)(void* pCookie, XnOSSeekType seekType, const XnInt32 nOffset); 00747 00755 XnUInt32 (XN_CALLBACK_TYPE* Tell)(void* pCookie); 00756 00762 void (XN_CALLBACK_TYPE* Close)(void* pCookie); 00763 } XnPlayerInputStreamInterface; 00764 00768 typedef struct XnNodeNotifications 00769 { 00776 XnStatus (XN_CALLBACK_TYPE* OnNodeAdded) 00777 (void* pCookie, const XnChar* strNodeName, XnProductionNodeType type, 00778 XnCodecID compression); 00779 00786 XnStatus (XN_CALLBACK_TYPE* OnNodeRemoved) 00787 (void* pCookie, const XnChar* strNodeName); 00788 00797 XnStatus (XN_CALLBACK_TYPE* OnNodeIntPropChanged) 00798 (void* pCookie, const XnChar* strNodeName, 00799 const XnChar* strPropName, XnUInt64 nValue); 00800 00809 XnStatus (XN_CALLBACK_TYPE* OnNodeRealPropChanged) 00810 (void* pCookie, const XnChar* strNodeName, 00811 const XnChar* strPropName, XnDouble dValue); 00812 00821 XnStatus (XN_CALLBACK_TYPE* OnNodeStringPropChanged) 00822 (void* pCookie, const XnChar* strNodeName, 00823 const XnChar* strPropName, const XnChar* strValue); 00824 00834 XnStatus (XN_CALLBACK_TYPE* OnNodeGeneralPropChanged) 00835 (void* pCookie, const XnChar* strNodeName, 00836 const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer); 00837 00844 XnStatus (XN_CALLBACK_TYPE* OnNodeStateReady) 00845 (void* pCookie, const XnChar* strNodeName); 00846 00856 XnStatus (XN_CALLBACK_TYPE* OnNodeNewData) 00857 (void* pCookie, const XnChar* strNodeName, 00858 XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize); 00859 00860 } XnNodeNotifications; 00861 00863 typedef struct XnUInt32XYPair 00864 { 00865 XnUInt32 X; 00866 XnUInt32 Y; 00867 } XnUInt32XYPair; 00868 00870 typedef struct XnOutputMetaData 00871 { 00873 XnUInt64 nTimestamp; 00874 00876 XnUInt32 nFrameID; 00877 00879 XnUInt32 nDataSize; 00880 00882 XnBool bIsNew; 00883 00884 } XnOutputMetaData; 00885 00887 typedef struct XnMapMetaData 00888 { 00890 XnOutputMetaData* pOutput; 00891 00893 XnUInt32XYPair Res; 00894 00896 XnUInt32XYPair Offset; 00897 00899 XnUInt32XYPair FullRes; 00900 00902 XnPixelFormat PixelFormat; 00903 00905 XnUInt32 nFPS; 00906 } XnMapMetaData; 00907 00909 typedef struct XnDepthMetaData 00910 { 00912 XnMapMetaData* pMap; 00913 00915 const XnDepthPixel* pData; 00916 00918 XnDepthPixel nZRes; 00919 } XnDepthMetaData; 00920 00922 typedef struct XnImageMetaData 00923 { 00925 XnMapMetaData* pMap; 00926 00928 const XnUInt8* pData; 00929 } XnImageMetaData; 00930 00932 typedef struct XnIRMetaData 00933 { 00935 XnMapMetaData* pMap; 00936 00938 const XnIRPixel* pData; 00939 } XnIRMetaData; 00940 00941 typedef struct XnAudioMetaData 00942 { 00944 XnOutputMetaData* pOutput; 00945 00947 XnWaveOutputMode Wave; 00948 00950 const XnUInt8* pData; 00951 } XnAudioMetaData; 00952 00953 typedef struct XnSceneMetaData 00954 { 00956 XnMapMetaData* pMap; 00957 00959 const XnLabel* pData; 00960 } XnSceneMetaData; 00961 00962 #pragma pack (pop) 00963 00964 #endif //__XN_TYPES_H__