Pose Detection Capability
C Reference » Production Nodes Functionality » User Generator

## Functions

XN_C_API XnUInt32 XN_C_DECL | xnGetNumberOfPoses (XnNodeHandle hInstance)
XN_C_API XnStatus XN_C_DECL | xnGetAvailablePoses (XnNodeHandle hInstance, XnChar **pstrPoses, XnUInt32 *pnPoses)
XN_C_API XnStatus XN_C_DECL | xnGetAllAvailablePoses (XnNodeHandle hInstance, XnChar **pstrPoses, XnUInt32 nNameLength, XnUInt32 *pnPoses)
XN_C_API XnBool XN_C_DECL | xnIsPoseSupported (XnNodeHandle hInstance, const XnChar *strPose)
XN_C_API XnStatus | xnGetPoseStatus (XnNodeHandle hInstance, XnUserID userID, const XnChar *poseName, XnUInt64 *poseTime, XnPoseDetectionStatus *eStatus, XnPoseDetectionState *eState)
XN_C_API XnStatus XN_C_DECL | xnStartPoseDetection (XnNodeHandle hInstance, const XnChar *strPose, XnUserID user)
XN_C_API XnStatus XN_C_DECL | xnStopPoseDetection (XnNodeHandle hInstance, XnUserID user)
XN_C_API XnStatus XN_C_DECL | xnStopSinglePoseDetection (XnNodeHandle hInstance, XnUserID user, const XnChar *strPose)
XN_C_API XnStatus XN_C_DECL | xnRegisterToPoseCallbacks (XnNodeHandle hInstance, XnPoseDetectionCallback PoseDetectionStartCB, XnPoseDetectionCallback PoseDetectionEndCB, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromPoseCallbacks (XnNodeHandle hInstance, XnCallbackHandle hCallback)
XN_C_API XnStatus | xnRegisterToPoseDetected (XnNodeHandle hInstance, XnPoseDetectionCallback handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void | xnUnregisterFromPoseDetected (XnNodeHandle hInstance, XnCallbackHandle hCallback)
XN_C_API XnStatus | xnRegisterToOutOfPose (XnNodeHandle hInstance, XnPoseDetectionCallback handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void | xnUnregisterFromOutOfPose (XnNodeHandle hInstance, XnCallbackHandle hCallback)
XN_C_API XnStatus XN_C_DECL | xnRegisterToPoseDetectionInProgress (XnNodeHandle hInstance, XnPoseDetectionInProgress handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromPoseDetectionInProgress (XnNodeHandle hInstance, XnCallbackHandle hCallback)

## Detailed Description

The Pose capability (XN_CAPABILITY_POSE_DETECTION) allows a User Generator to recognize when the user is in a specific pose.

## Function Documentation

## xnGetAllAvailablePoses()

XN_C_API XnStatus XN_C_DECL xnGetAllAvailablePoses | ( | XnNodeHandle | hInstance,
|  | XnChar ** | pstrPoses,
|  | XnUInt32 | nNameLength,
|  | XnUInt32 * | pnPoses )

Get the names of the supported poses.

Parameters

  hInstance | [in] A handle to the instance
  pstrPoses | [out] Pre-allocated memory for the names of the supported poses
  nNameLength | [in] Memory size for each pose name
  pnPoses | [in,out] In input - size of the preallocated memory, in output - the number of pose names

## xnGetAvailablePoses()

XN_C_API XnStatus XN_C_DECL xnGetAvailablePoses | ( | XnNodeHandle | hInstance,
|  | XnChar ** | pstrPoses,
|  | XnUInt32 * | pnPoses )

Get the names of the supported poses.

Parameters

  hInstance | [in] A handle to the instance
  pstrPoses | [out] Pre-allocated memory for the names of the supported poses
  pnPoses | [in,out] In input - size of the preallocated memory, in output - the number of pose names

## xnGetNumberOfPoses()

XN_C_API XnUInt32 XN_C_DECL xnGetNumberOfPoses | ( | XnNodeHandle | hInstance | ) |

Get the number of the supported poses.

Parameters

  hInstance | [in] A handle to the instance

## xnGetPoseStatus()

XN_C_API XnStatus xnGetPoseStatus | ( | XnNodeHandle | hInstance,
|  | XnUserID | userID,
|  | const XnChar * | poseName,
|  | XnUInt64 * | poseTime,
|  | XnPoseDetectionStatus * | eStatus,
|  | XnPoseDetectionState * | eState )

Gets the current pose status.

Parameters

  hInstance | [in] A handle to the instance
  userID | [in] The user whose pose status we are interested in.
  poseName | [in] The pose we want to get a status on.
  poseTime | [out] The time stamp in which the user entered into the pose (0 if not in pose).
  eStatus | [out] The status of the user's pose, i.e. the progress error for getting into pose (XnPoseDetectionStatus, the same as received from the in progress callback. See xnRegisterToPoseDetectionInProgress).
  eState | [out] The state of the user pose (i.e. in pose, out of pose).

Returns
  The success status. The data is invalid if failed.

## xnIsPoseSupported()

XN_C_API XnBool XN_C_DECL xnIsPoseSupported | ( | XnNodeHandle | hInstance,
|  | const XnChar * | strPose )

Tests if a pose is supported.

Parameters

  hInstance | [in] A handle to the instance
  strPose | [in] The pose string to test

Returns
  True if the pose is supported and False otherwise.

## xnRegisterToOutOfPose()

XN_C_API XnStatus xnRegisterToOutOfPose | ( | XnNodeHandle | hInstance,
|  | XnPoseDetectionCallback | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Register to callback when a use is no longer in pose.

Parameters

  hInstance | [in] A handle to the instance
  handler | [in] Callback to be called when user isn't in pose anymore
  pCookie | [in] User's cookie, to be delivered to the callback
  phCallback | [out] the handle to this callback, to allow unregistration

## xnRegisterToPoseCallbacks()

XN_C_API XnStatus XN_C_DECL xnRegisterToPoseCallbacks | ( | XnNodeHandle | hInstance,
|  | XnPoseDetectionCallback | PoseDetectionStartCB,
|  | XnPoseDetectionCallback | PoseDetectionEndCB,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Register to callbacks for pose events.

Parameters

  hInstance | [in] A handle to the instance
  PoseDetectionStartCB | [in] Function to be called when the pose is detected
  PoseDetectionEndCB | [in] Function to be called when the user is out of pose
  pCookie | [in] User's cookie, to be delivered to the callbacks
  phCallback | [out] The handle to these callbacks, to allow unregistration

## xnRegisterToPoseDetected()

XN_C_API XnStatus xnRegisterToPoseDetected | ( | XnNodeHandle | hInstance,
|  | XnPoseDetectionCallback | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Register to callback when a user is in pose.

Parameters

  hInstance | [in] A handle to the instance
  handler | [in] Callback to be called when the pose is detected
  pCookie | [in] User's cookie, to be delivered to the callback
  phCallback | [out] the handle to this callback, to allow unregistration

## xnRegisterToPoseDetectionInProgress()

XN_C_API XnStatus XN_C_DECL xnRegisterToPoseDetectionInProgress | ( | XnNodeHandle | hInstance,
|  | XnPoseDetectionInProgress | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Register to callback for status when pose is detected.

Parameters

  hInstance | [in] A handle to the instance
  handler | [in] Function to be called when pose detection is in progress
  pCookie | [in] User's cookie, to be delivered to the callbacks
  phCallback | [out] The handle to these callbacks, to allow unregistration

## xnStartPoseDetection()

XN_C_API XnStatus XN_C_DECL xnStartPoseDetection | ( | XnNodeHandle | hInstance,
|  | const XnChar * | strPose,
|  | XnUserID | user )

Start detection of a specific pose for a specific user.

Parameters

  hInstance | [in] A handle to the instance
  strPose | [in] Name of requested pose
  user | [in] Id of user

## xnStopPoseDetection()

XN_C_API XnStatus XN_C_DECL xnStopPoseDetection | ( | XnNodeHandle | hInstance,
|  | XnUserID | user )

Stop detection of poses for a specific user.

Parameters

  hInstance | [in] A handle to the instance
  user | [in] Id of user

## xnStopSinglePoseDetection()

XN_C_API XnStatus XN_C_DECL xnStopSinglePoseDetection | ( | XnNodeHandle | hInstance,
|  | XnUserID | user,
|  | const XnChar * | strPose )

Stop detection of a specific pose for a specific user.

Parameters

  hInstance | [in] A handle to the instance
  user | [in] Id of user
  strPose | [in] Name of the pose

## xnUnregisterFromOutOfPose()

XN_C_API void xnUnregisterFromOutOfPose | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregister from out of pose callback.

Parameters

  [in] | hInstance | A handle to the instance
  [in] | hCallback | The handle received from registration

## xnUnregisterFromPoseCallbacks()

XN_C_API void XN_C_DECL xnUnregisterFromPoseCallbacks | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregister from pose events.

Parameters

  hInstance | [in] A handle to the instance
  hCallback | [in] The handle received from registration

## xnUnregisterFromPoseDetected()

XN_C_API void xnUnregisterFromPoseDetected | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregister from pose detected callback.

Parameters

  [in] | hInstance | A handle to the instance
  [in] | hCallback | The handle received from registration

## xnUnregisterFromPoseDetectionInProgress()

XN_C_API void XN_C_DECL xnUnregisterFromPoseDetectionInProgress | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregister from pose status callback.

Parameters

  hInstance | [in] A handle to the instance
  hCallback | [in] The handle received from registration