Hola!

Después del quick post de ayer sobre cómo mostrar el feed de la camára con Vituvius, hoy una pequeña variación sobre el mismo para mostrar el Feed del Sensor de Profundidad.

En este caso, la suscripción es al evento DepthFrameReady (línea 21) y en la línea 25 podemos ver como se procesa el mismo.

   1: using System.Windows;

   2: using LightBuzz.Vitruvius;

   3: using LightBuzz.Vitruvius.WPF;

   4: using Microsoft.Kinect;

   5:  

   6: namespace WPFAppVit02

   7: {

   8:     public partial class MainWindow : Window

   9:     {

  10:         public MainWindow()

  11:         {

  12:             InitializeComponent();

  13:             Loaded += MainWindow_Loaded;

  14:         }

  15:  

  16:         void MainWindow_Loaded(object sender, RoutedEventArgs e)

  17:         {

  18:             var sensor = SensorExtensions.Default();

  19:             if (sensor == null) return;

  20:             sensor.EnableAllStreams();

  21:             sensor.DepthFrameReady += Sensor_DepthFrameReady;

  22:             sensor.Start();

  23:         }

  24:  

  25:         void Sensor_DepthFrameReady(object sender, DepthImageFrameReadyEventArgs e)

  26:         {

  27:             using (var frame = e.OpenDepthImageFrame())

  28:             {

  29:                 if (frame != null)

  30:                 {

  31:                     ImageDepth.Source = frame.ToBitmap();

  32:                 }

  33:             }

  34:         }

  35:     }

  36: }

Happy Coding!

Saludos @ Valencia

El Bruno

image image image Google

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading