Image Generator
C Reference » Production Nodes Functionality

## Functions

XN_C_API XnStatus XN_C_DECL | xnCreateImageGenerator (XnContext *pContext, XnNodeHandle *phImageGenerator, XnNodeQuery *pQuery, XnEnumerationErrors *pErrors)
XN_C_API XnRGB24Pixel *XN_C_DECL | xnGetRGB24ImageMap (XnNodeHandle hInstance)
XN_C_API XnYUV422DoublePixel *XN_C_DECL | xnGetYUV422ImageMap (XnNodeHandle hInstance)
XN_C_API XnGrayscale8Pixel *XN_C_DECL | xnGetGrayscale8ImageMap (XnNodeHandle hInstance)
XN_C_API XnGrayscale16Pixel *XN_C_DECL | xnGetGrayscale16ImageMap (XnNodeHandle hInstance)
XN_C_API XnUInt8 *XN_C_DECL | xnGetImageMap (XnNodeHandle hInstance)
XN_C_API XnBool XN_C_DECL | xnIsPixelFormatSupported (XnNodeHandle hInstance, XnPixelFormat Format)
XN_C_API XnStatus XN_C_DECL | xnSetPixelFormat (XnNodeHandle hInstance, XnPixelFormat Format)
XN_C_API XnPixelFormat XN_C_DECL | xnGetPixelFormat (XnNodeHandle hInstance)
XN_C_API XnStatus XN_C_DECL | xnRegisterToPixelFormatChange (XnNodeHandle hInstance, XnStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromPixelFormatChange (XnNodeHandle hInstance, XnCallbackHandle hCallback)
XN_C_API void XN_C_DECL | xnGetImageMetaData (XnNodeHandle hInstance, XnImageMetaData *pMetaData)

## Detailed Description

An Image Generator node is a Map Generator that outputs image maps. It supports all Map Generator functions, and adds additional functions. Image maps may arrive in different pixel formats.

## Function Documentation

## xnCreateImageGenerator()

XN_C_API XnStatus XN_C_DECL xnCreateImageGenerator | ( | XnContext * | pContext,
|  | XnNodeHandle * | phImageGenerator,
|  | XnNodeQuery * | pQuery,
|  | XnEnumerationErrors * | pErrors )

Creates an image generator.

Parameters

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

## xnGetGrayscale16ImageMap()

XN_C_API XnGrayscale16Pixel *XN_C_DECL xnGetGrayscale16ImageMap | ( | XnNodeHandle | hInstance | ) |

Gets the current Grayscale16 image-map. This map is updated after a call to xnWaitAndUpdateData(). It is assumed that the node is currently in Grayscale16 pixel format.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not an image generator.

## xnGetGrayscale8ImageMap()

XN_C_API XnGrayscale8Pixel *XN_C_DECL xnGetGrayscale8ImageMap | ( | XnNodeHandle | hInstance | ) |

Gets the current Grayscale8 image-map. This map is updated after a call to xnWaitAndUpdateData(). It is assumed that the node is currently in Grayscale8 pixel format.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not an image generator.

## xnGetImageMap()

XN_C_API XnUInt8 *XN_C_DECL xnGetImageMap | ( | XnNodeHandle | hInstance | ) |

Gets the current image-map as a byte buffer.

This map is updated after a call to xnWaitAndUpdateData(). It is highly advised not to use this function. Instead, if you know the format of the image, use xnGetRGB24ImageMap(), xnGetYUV422ImageMap(), xnGetGrayscale8ImageMap() or xnGetGrayscale16ImageMap().

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not an image generator.

## xnGetImageMetaData()

XN_C_API void XN_C_DECL xnGetImageMetaData | ( | XnNodeHandle | hInstance,
|  | XnImageMetaData * | pMetaData )

Gets the current image-map meta data.

Parameters

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

## xnGetPixelFormat()

XN_C_API XnPixelFormat XN_C_DECL xnGetPixelFormat | ( | XnNodeHandle | hInstance | ) |

Gets current pixel format.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  -1 if this production node is not an image generator.

## xnGetRGB24ImageMap()

XN_C_API XnRGB24Pixel *XN_C_DECL xnGetRGB24ImageMap | ( | XnNodeHandle | hInstance | ) |

Gets the current RGB24 image-map. This map is updated after a call to xnWaitAndUpdateData(). It is assumed that the node is currently in RGB24 pixel format.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not an image generator.

## xnGetYUV422ImageMap()

XN_C_API XnYUV422DoublePixel *XN_C_DECL xnGetYUV422ImageMap | ( | XnNodeHandle | hInstance | ) |

Gets the current YUV422 image-map. This map is updated after a call to xnWaitAndUpdateData(). It is assumed that the node is currently in YUV422 pixel format.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  NULL if this production node is not an image generator.

## xnIsPixelFormatSupported()

XN_C_API XnBool XN_C_DECL xnIsPixelFormatSupported | ( | XnNodeHandle | hInstance,
|  | XnPixelFormat | Format )

Checks if a specific pixel format is supported.

Parameters

  hInstance | [in] A handle to the instance.
  Format | [in] The format to check for.

## xnRegisterToPixelFormatChange()

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

Registers a callback function to pixel format changes.

Parameters

  hInstance | [in] A handle to the instance.
  handler | [in] A pointer to a function that will be called when pixel format 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 xnUnregisterFromPixelFormatChange.

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

## xnSetPixelFormat()

XN_C_API XnStatus XN_C_DECL xnSetPixelFormat | ( | XnNodeHandle | hInstance,
|  | XnPixelFormat | Format )

Sets the pixel format of the image map.

Parameters

  hInstance | [in] A handle to the instance.
  Format | [in] The format to set.

Returns
  XN_STATUS_INVALID_OPERATION if this production node is not an image generator.

## xnUnregisterFromPixelFormatChange()

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

Unregisters a callback function which was registered using xnRegisterToPixelFormatChange.

Parameters

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