2

I am currently working with Kinect, and I want to draw the bones of a skeleton on the VGA image of the kinect. First, I get the picture from the kinect:

HRESULT hr = globalNui->NuiImageStreamGetNextFrame( videoStreamHandle, 0, &frame);
INuiFrameTexture * texture = frame.pFrameTexture;
NUI_LOCKED_RECT lockedRect;
texture->LockRect( 0, &lockedRect, NULL, 0);

Here we have it in a NUI_LOCKED_RECT, so we can do anything with it. The most common way is to just convert it to a bitmap and put it on the screen, but I want to make some modifications to the image. I use Direct2D to bring it on the screen, so I need an image format that can be converted to ID2D1Bitmap, and I must be able to draw lines and points on it. What kind of image do I need?

4

2 回答 2

1

The locked buffer will contain a simple array of size width * height * 4 bytes. Each pixel is a 4 byte XRGB (see docs here: http://msdn.microsoft.com/en-us/library/jj131027.aspx). The image will be stored in row-order, so a pixel at position x,y will have the array index ((width * y) + x) * 4).

This is a standard image buffer format which you can freely use with pretty much any other image manipulation library such as Microsoft's own WIC, or IPL or OpenCV or whatever. You should have no problem iterating across the buffer and setting the RGB values directly, which for simple graphical work should be more than sufficient.

于 2012-11-12T16:14:54.523 回答
0

So I figuered that there are just no image formats doing what I want. No problem, because I found out about all the possibilities of Direct2D. Now I am not actually changing the image, but to the user it looks the same.

于 2012-11-14T12:00:23.237 回答