DepthImageFrame.CopyDepthImagePixelDataTo Method (IntPtr, Int32)
Kinect for Windows 1.5, 1.6, 1.7, 1.8
Copies the per-pixel depth data to a pre-allocated byte array using the pixel data length.
Syntax
public void CopyDepthImagePixelDataTo (
IntPtr pixelData,
int pixelDataLength
)
Parameters
- pixelData
Type: IntPtr
Address of a byte array to receive the pixel data. The array size must be equal to sizeof(DepthImagePixel) times the PixelDataLength property. - pixelDataLength
Type: Int32
The number of pixels in the frame (as obtained from the PixelDataLength property).
Remarks
Each pixel of depth data is stored in a DepthImagePixel; therefore the array must have sufficient room for all of the DepthImagePixel values in the frame. Here's an example:
// For depth data //frame = DepthImageFrame IntPtr pixelData = Marshal.AllocHGlobal(sizeof(DepthImagePixel) * frame.PixelDataLength); try { frame.CopyDepthImagePixelDataTo(pixelData, frame.PixelDataLength); // use the data that has been copied to pixelData ... } finally { if (pixelData != IntPtr.Zero) Marshal.FreeHGlobal(pixelData); }
Requirements
Namespace: Microsoft.Kinect
Assembly: Microsoft.Kinect (in microsoft.kinect.dll)
See Also
Reference
DepthImageFrame Class
DepthImageFrame Members
Microsoft.Kinect Namespace