GetCameraDepthFrameRGB32() 개인적인 메소드

private GetCameraDepthFrameRGB32 ( IntPtr camera, IntPtr data, int timeout ) : bool
camera System.IntPtr
data System.IntPtr
timeout int
리턴 bool
예제 #1
0
 void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (running == true)
     {
         running = false;
         captureThread.Join();
         if (camera != IntPtr.Zero)
         {
             CLNUIDevice.StopCamera(camera);
             CLNUIDevice.DestroyCamera(camera);
         }
         camera = CLNUIDevice.CreateCamera(devSerial);
     }
     if (comboFEED.SelectedIndex == 0)
     {
         colorImage    = new NUIImage(640, 480);
         feed.Source   = colorImage.BitmapSource;
         running       = true;
         captureThread = new Thread(delegate()
         {
             CLNUIDevice.StartCamera(camera);
             while (running)
             {
                 CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 500);
                 Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                 {
                     colorImage.Invalidate();
                 });
             }
             CLNUIDevice.StopCamera(camera);
         });
         captureThread.IsBackground = true;
         captureThread.Start();
     }
     else
     {
         colorImage    = new NUIImage(640, 480);
         feed.Source   = colorImage.BitmapSource;
         running       = true;
         captureThread = new Thread(delegate()
         {
             CLNUIDevice.StartCamera(camera);
             while (running)
             {
                 CLNUIDevice.GetCameraDepthFrameRGB32(camera, colorImage.ImageData, 500);
                 Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                 {
                     colorImage.Invalidate();
                 });
             }
             CLNUIDevice.StopCamera(camera);
         });
         captureThread.IsBackground = true;
         captureThread.Start();
     }
 }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            Closing += new System.ComponentModel.CancelEventHandler(OnClosing);

            if (CLNUIDevice.GetDeviceCount() < 1)
            {
                MessageBox.Show("Is the Kinect plugged in?");
                Environment.Exit(0);
            }

            string serialString = CLNUIDevice.GetDeviceSerial(0);

            camera = CLNUIDevice.CreateCamera(serialString);

            colorImage = new NUIImage(640, 480);
            depthImage = new NUIImage(640, 480);
            rawImage   = new NUIImage(640, 480);

            color.Source = colorImage.BitmapSource;
            depth.Source = depthImage.BitmapSource;

            running       = true;
            captureThread = new Thread(delegate()
            {
                if (CLNUIDevice.StartCamera(camera))
                {
                    while (running)
                    {
                        CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 0);
                        CLNUIDevice.GetCameraDepthFrameRGB32(camera, depthImage.ImageData, 0);
                        CLNUIDevice.GetCameraDepthFrameRAW(camera, rawImage.ImageData, 0);
                        Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                        {
                            colorImage.Invalidate();
                            depthImage.Invalidate();
                        });
                    }
                }
            });
            captureThread.IsBackground = true;
            captureThread.Start();
        }
예제 #3
0
        public CameraWindow(string devSerial)
        {
            InitializeComponent();
            Closing += new System.ComponentModel.CancelEventHandler(OnClosing);

            xp.Minimum = -981;
            xp.Maximum = 981;
            yp.Minimum = -981;
            yp.Maximum = 981;
            zp.Minimum = -981;
            zp.Maximum = 981;

            try
            {
                motor  = CLNUIDevice.CreateMotor(devSerial);
                camera = CLNUIDevice.CreateCamera(devSerial);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Environment.Exit(0);
            }

            CLNUIDevice.SetMotorPosition(motor, 0);

            serial.Content     = string.Format("Serial Number: {0}", devSerial);
            accelerometerTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(100), DispatcherPriority.Normal, (EventHandler) delegate(object sender, EventArgs e)
            {
                short _x = 0, _y = 0, _z = 0;
                CLNUIDevice.GetMotorAccelerometer(motor, ref _x, ref _y, ref _z);
                x.Content = _x.ToString();
                xp.Value  = _x;
                y.Content = _y.ToString();
                yp.Value  = _y;
                z.Content = _z.ToString();
                zp.Value  = _z;
            }, Dispatcher);
            accelerometerTimer.Start();

            led.SelectionChanged += new SelectionChangedEventHandler(led_SelectionChanged);
            led.SelectedIndex     = 0;

            colorImage   = new NUIImage(640, 480);
            color.Source = colorImage.BitmapSource;

            depthImage   = new NUIImage(640, 480);
            depth.Source = depthImage.BitmapSource;

            running       = true;
            captureThread = new Thread(delegate()
            {
//                 Trace.WriteLine(string.Format("Camera {0:X}", camera.ToInt32()));
                if (CLNUIDevice.StartCamera(camera))
                {
                    while (running)
                    {
                        CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 500);
                        CLNUIDevice.GetCameraDepthFrameRGB32(camera, depthImage.ImageData, 0);
                        Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                        {
                            colorImage.Invalidate();
                            depthImage.Invalidate();
                        });
                    }
                    CLNUIDevice.StopCamera(camera);
                }
            });
            captureThread.IsBackground = true;
            captureThread.Start();
        }