ColorImageFrame.CopyPixelDataTo Method (IntPtr, Int32)
Kinect for Windows 1.5, 1.6, 1.7, 1.8
Copies a frame of color data to a pre-allocated array of bytes using the pixel data length. The array size must be equal to the ColorImageFrame.PixelDataLength Property.
Syntax
public void CopyPixelDataTo (
IntPtr pixelData,
int pixelDataLength
)
Parameters
- pixelData
Type: IntPtr
An array of bytes to receive the pixel data. - pixelDataLength
Type: Int32
The total length of the pixel data buffer (in bytes).
Remarks
Each pixel of color data is stored in a byte; therefore the array in this method is an array of bytes. Here's an example:
// For color data //frame = ColorImageFrame byte[] data = new byte[frame.PixelDataLength]; IntPtr pixelData = Marshal.AllocHGlobal(data.Length); try { frame.CopyPixelDataTo(pixelData, data.Length); } finally { if (pixelData != IntPtr.Zero) Marshal.FreeHGlobal(pixelData); }
Requirements
Namespace: Microsoft.Kinect
Assembly: Microsoft.Kinect (in microsoft.kinect.dll)
See Also
Reference
ColorImageFrame Class
ColorImageFrame Members
Microsoft.Kinect Namespace