INuiSensor::NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution Method

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Gets the pixel coordinates in color space that correspond to the specified pixel coordinates in depth space, using the specified depth resolution.

public:
HRESULT NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(
         NUI_IMAGE_RESOLUTION eColorResolution,
         NUI_IMAGE_RESOLUTION eDepthResolution,
         DWORD cDepthValues,
         USHORT *pDepthValues,
         DWORD cColorCoordinates,
         LONG *pColorCoordinates
)

Parameters

eColorResolution
Type: NUI_IMAGE_RESOLUTION
[in] The resolution of the color image, as a NUI_IMAGE_RESOLUTION enumeration constant.
eDepthResolution
Type: NUI_IMAGE_RESOLUTION
[in] The resolution of the depth image, as a NUI_IMAGE_RESOLUTION enumeration constant.
cDepthValues
Type: DWORD
[in] The number of values in the depth frame.
pDepthValues
Type: USHORT
[in] A pointer to an array of values in the depth frame.
cColorCoordinates
Type: DWORD
[in] The number of values in the color frame.
pColorCoordinates
Type: LONG
[in] A pointer to an array of coordinates in the color frame coordinate space, two LONGs per each depth coordinate, representing the x- and y-coordinates respectively. For instance, (pColorCoordinates[0], pColorCoordinates[1]) is the first (X,Y) coordinate (in color space) of the first depth point, (pColorCoordinates[2], pColorCoordinates[3]) is the second point, (pColorColorCoordinates[4], pColorColorCoordinates[5]) is the third point etc.

Return Value

Type: HRESULT
Returns S_OK if successful; otherwise, returns one of the failure codes in the following table.
ErrorDescription
E_INVALIDARGAn invalid resolution was specified or does not correspond to the cColorCoordinates or cDepthCoordinates parameters.
E_NUI_DEVICE_NOT_READYThe device has not been initialized. Refer to NuiInitialize.
E_POINTERThe value of plColorX or plColorY parameter is NULL.

Because depth image data and color image data come from separate sensors, pixels in the two images may not always line up exactly. The two sensors may have different fields of view, or may not be aimed precisely in the same direction. This means that a point near the edge of the depth image may correspond to a pixel just beyond the edge of the color image, or vice versa.

This function accepts coordinates outside the bounds of the depth image. It may return pixels outside the color image. This means that you can use data from the two images in combination, even when the two images do not line up completely. You must verify that the coordinates that are returned lie within the color image before using the coordinates to reference pixels in that color image.

The depth image coordinates you specify are not required to be within the bounds of the depth frame image, but they should not be too far outside the depth frame image bounds. If the coordinates are far outside the depth frame image, they are unlikely to map to coordinates inside the bounds of the color image. This function will then return color image coordinates that are unlikely to be useful.

For more information, see Data Streams.

Header: Declared in NuiSensor.h; however, include NuiApi.h in your project.

Community Additions

ADD
Show: