示例#1
0
 public ColorDataChangedEvent ColorDataChanged; // Color data change
 protected virtual void ColorDataChange(ColorDataChangeEventArgs e)
 {
     if (ColorDataChanged != null)
     {
         ColorDataChanged(this, e);
     }
 }
示例#2
0
 // Event Handler for ColorFrameReady events
 // (A new frame of ColorStream data is available)
 private void KinectColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
 {
     // Get the current ColorImageFrame
     using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
     {
         if (colorFrame != null)
         {
             try
             {
                 // Get the pixel data from the ColorImageFrame
                 colorFrame.CopyPixelDataTo(this.colorStreamData);
                 // Write the pixel data to the colorBitmap image
                 colorBitmap.WritePixels(new Int32Rect(0, 0, colorFrame.Width, colorFrame.Height), colorStreamData, colorFrame.Width * colorFrame.BytesPerPixel, 0);
                 // Dispatch the ColorDataChange event
                 ColorDataChangeEventArgs c = new ColorDataChangeEventArgs(colorStreamData);
                 ColorDataChange(c);
             }
             catch (NullReferenceException ex)
             {
                 Console.WriteLine(ex.TargetSite + " - " + ex.Message);
             }
         }
     }
 }
示例#3
0
 // Event Handler for ColorFrameReady events
 // (A new frame of ColorStream data is available)
 private void KinectColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
 {
     // Get the current ColorImageFrame
     using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
     {
         if (colorFrame != null)
         {
             try
             {
                 // Get the pixel data from the ColorImageFrame
                 colorFrame.CopyPixelDataTo(this.colorStreamData);
                 // Write the pixel data to the colorBitmap image
                 colorBitmap.WritePixels(new Int32Rect(0, 0, colorFrame.Width, colorFrame.Height), colorStreamData, colorFrame.Width * colorFrame.BytesPerPixel, 0);
                 // Dispatch the ColorDataChange event
                 ColorDataChangeEventArgs c = new ColorDataChangeEventArgs(colorStreamData);
                 ColorDataChange(c);
             }
             catch (NullReferenceException ex)
             {
                 Console.WriteLine(ex.TargetSite + " - " + ex.Message);
             }
         }
     }
 }
示例#4
0
 protected virtual void ColorDataChange(ColorDataChangeEventArgs e)
 {
     if (ColorDataChanged != null)
     {
         ColorDataChanged(this, e);
     }
 }
 // Event Handler for changes in Color data
 // Allows for direct access to the color data
 private void ColorDataChange(object sender, ColorDataChangeEventArgs e)
 {
     Console.WriteLine("Here's the first color byte: " + e.colorData[0].ToString());
 }
示例#6
0
 // Event Handler for changes in Color data
 // Allows for direct access to the color data
 private void ColorDataChange(object sender, ColorDataChangeEventArgs e)
 {
     Console.WriteLine("Here's the first color byte: " + e.colorData[0].ToString());
 }