Depth Generator
C Reference » Production Nodes Functionality

## Topics

| User Position Capability

## Functions

XN_C_API XnStatus XN_C_DECL | xnCreateDepthGenerator (XnContext *pContext, XnNodeHandle *phDepthGenerator, XnNodeQuery *pQuery, XnEnumerationErrors *pErrors)
XN_C_API XnDepthPixel XN_C_DECL | xnGetDeviceMaxDepth (XnNodeHandle hInstance)
XN_C_API XnStatus XN_C_DECL | xnGetDepthFieldOfView (XnNodeHandle hInstance, XnFieldOfView *pFOV)
XN_C_API XnStatus XN_C_DECL | xnRegisterToDepthFieldOfViewChange (XnNodeHandle hInstance, XnStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromDepthFieldOfViewChange (XnNodeHandle hInstance, XnCallbackHandle hCallback)
XN_C_API XnStatus XN_C_DECL | xnConvertProjectiveToRealWorld (XnNodeHandle hInstance, XnUInt32 nCount, const XnPoint3D *aProjective, XnPoint3D *aRealWorld)
XN_C_API XnStatus XN_C_DECL | xnConvertRealWorldToProjective (XnNodeHandle hInstance, XnUInt32 nCount, const XnPoint3D *aRealWorld, XnPoint3D *aProjective)
XN_C_API XnDepthPixel *XN_C_DECL | xnGetDepthMap (XnNodeHandle hInstance)
XN_C_API void XN_C_DECL | xnGetDepthMetaData (XnNodeHandle hInstance, XnDepthMetaData *pMetaData)

## Detailed Description

A Depth Generator node is a Map Generator that outputs depth maps. It supports all Map Generator functions, and adds additional functions.

## Function Documentation

## xnConvertProjectiveToRealWorld()

XN_C_API XnStatus XN_C_DECL xnConvertProjectiveToRealWorld | ( | XnNodeHandle | hInstance,
|  | XnUInt32 | nCount,
|  | const XnPoint3D * | aProjective,
|  | XnPoint3D * | aRealWorld )

Converts a list of points from projective coordinates to real world coordinates.

Parameters

  hInstance | [in] A handle to the instance.
  nCount | [in] The number of points to translate.
  aProjective | [in] An array of projective coordinates points.
  aRealWorld | [in/out] An array to be filled with real world coordinates points.

Returns
  XN_STATUS_INVALID_OPERATION if this production node is not a depth generator.

## xnConvertRealWorldToProjective()

XN_C_API XnStatus XN_C_DECL xnConvertRealWorldToProjective | ( | XnNodeHandle | hInstance,
|  | XnUInt32 | nCount,
|  | const XnPoint3D * | aRealWorld,
|  | XnPoint3D * | aProjective )

Converts a list of points from projective coordinates to real world coordinates.

Parameters

  hInstance | [in] A handle to the instance.
  nCount | [in] The number of points to translate.
  aRealWorld | [in] An array of real world coordinates points.
  aProjective | [in/out] An array to be filled with projective coordinates points.

Returns
  XN_STATUS_INVALID_OPERATION if this production node is not a depth generator.

## xnCreateDepthGenerator()

XN_C_API XnStatus XN_C_DECL xnCreateDepthGenerator | ( | XnContext * | pContext,
|  | XnNodeHandle * | phDepthGenerator,
|  | XnNodeQuery * | pQuery,
|  | XnEnumerationErrors * | pErrors )

Creates a depth generator.

Parameters

  pContext | [in] The context in which to create the depth generator
  phDepthGenerator | [out] A handle to the created depth generator
  pQuery | [in] Optional. Can be used to select which depth generator to create. If not specified, this function may create any depth generator that is available.
  pErrors | [in] Optional. If provided, will be filled with information about depth generators that could not be created.

## xnGetDepthFieldOfView()

XN_C_API XnStatus XN_C_DECL xnGetDepthFieldOfView | ( | XnNodeHandle | hInstance,
|  | XnFieldOfView * | pFOV )

Gets the Field-Of-View of the depth generator, in radians.

Parameters

  hInstance | [in] A handle to the instance.
  pFOV | [in] A struct to be filled with field of view.

Returns
  XN_STATUS_INVALID_OPERATION if this production node is not a depth generator.

## xnGetDepthMap()

XN_C_API XnDepthPixel *XN_C_DECL xnGetDepthMap | ( | XnNodeHandle | hInstance | ) |

Gets the current depth-map. This map is updated after a call to xnWaitAndUpdateData().

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not a depth generator.

## xnGetDepthMetaData()

XN_C_API void XN_C_DECL xnGetDepthMetaData | ( | XnNodeHandle | hInstance,
|  | XnDepthMetaData * | pMetaData )

Gets the current depth-map meta data.

Parameters

  hInstance | [in] A handle to the instance.
  pMetaData | [in] The struct to be filled.

## xnGetDeviceMaxDepth()

XN_C_API XnDepthPixel XN_C_DECL xnGetDeviceMaxDepth | ( | XnNodeHandle | hInstance | ) |

Gets the maximum depth the device can produce.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  -1 if this production node is not a depth generator.

## xnRegisterToDepthFieldOfViewChange()

XN_C_API XnStatus XN_C_DECL xnRegisterToDepthFieldOfViewChange | ( | XnNodeHandle | hInstance,
|  | XnStateChangedHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to field of view changes.

Parameters

  hInstance | [in] A handle to the instance.
  handler | [in] A pointer to a function that will be called when field of view changes.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromDepthFieldOfViewChange.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the User Position capability.

## xnUnregisterFromDepthFieldOfViewChange()

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

Unregisters a callback function which was registered using xnRegisterToDepthFieldOfViewChange.

Parameters

  hInstance | [in] A handle to the instance.
  hCallback | [in] The handle to the callback returned from xnRegisterToDepthFieldOfViewChange.