none
buffer size for depth RRS feed

  • Question

  • private KinectSensor _Kinect; private DepthImageFrame _LastDepthFrame; private WriteableBitmap _RawDepthImage; private Int32Rect _RawDepthImageRect; private int _RawDepthImageStride; private short[] _DepthImagePixelData;


    private void InitializeKinectSensor(KinectSensor sensor) { if (sensor != null) { DepthImageStream depthStream = sensor.DepthStream; depthStream.Enable(); //Enable depth camara //WRITEABLE BITMAP this._RawDepthImage = new WriteableBitmap(depthStream.FrameWidth, depthStream.FrameHeight, 96, 96, PixelFormats.Gray32Float, null); this._RawDepthImageRect = new Int32Rect(0, 0, depthStream.FrameWidth, depthStream.FrameHeight); this._RawDepthImageStride =depthStream.FrameWidth * depthStream.FrameBytesPerPixel; DepthImage.Source = this._RawDepthImage; _DepthImagePixelData = new short[depthStream.FramePixelDataLength]; //start sensor sensor.DepthFrameReady += Kinect_DepthFrameReady; //create event when there is a camera stream sensor.Start(); } }


    private void Kinect_DepthFrameReady(object sender, DepthImageFrameReadyEventArgs e) { using (DepthImageFrame frame = e.OpenDepthImageFrame()) { if (this._LastDepthFrame != null) { this._LastDepthFrame.Dispose(); this._LastDepthFrame = null; } this._LastDepthFrame = e.OpenDepthImageFrame(); if (this._LastDepthFrame != null) { this._LastDepthFrame.CopyPixelDataTo(this._DepthImagePixelData); this._RawDepthImage.WritePixels(this._RawDepthImageRect, this._DepthImagePixelData, this._RawDepthImageStride, 0); } } es / 12; depthInches = depthInches % 12; PixelDepth.Text = string.Format("{0}mm ~ {1}'{2}\"", depth, depthFt, depthInches); } }

    Hi, I'm new in programming Kinect, I'm folowing the book "Beggining Kinect Programming with the Microsoft Kinect SDK". When I run the code, it says "buffer size is not sufficient' in the line (this._RawDepthImage.WritePixels()) How can I fix it?

    Thanks

    Friday, October 12, 2012 8:18 PM

Answers