private void AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {
                if (colorFrame == null)
                {
                    return;
                }

                colorFrame.CopyPixelDataTo(ColorPixels);

                ColorBitmap.WritePixels(
                    new Int32Rect(0, 0, ColorBitmap.PixelWidth, ColorBitmap.PixelHeight),
                    ColorPixels,
                    ColorBitmap.PixelWidth * sizeof(int),
                    0);

                DetectMotion();
            }

            if (FrameUpdated != null)
            {
                FrameUpdated(this, new EventArgs());
            }
        }
Beispiel #2
0
 //Draw Color Frame
 public static void DrawColorFrame(TColorFrame colorData)
 {
     ColorBitmap.WritePixels(
         new Int32Rect(0, 0, ColorBitmap.PixelWidth, ColorBitmap.PixelHeight),
         colorData.ColorData,
         ColorBitmap.PixelWidth * sizeof(int),
         0);
 }