none
kinect camera failed to create RRS feed

  • Question

  • hi friends, I come from China. I like kinect development, sample code, according to Microsoft, however, I found that to create the camera failed. Please help me, thank you!

    (In fact, I only a little bit of English translations of these thanks to Google)

    my question:Code is correct, the image1 control does not return an RGBimage

    my code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Microsoft.Research.Kinect.Nui; // kinect 声明
    
    
    namespace KinectWpfDemo
    {
      /// <summary>
      /// MainWindow.xaml 的交互逻辑
      /// </summary>
      public partial class MainWindow : Window
      {
        public MainWindow()
        {
         
          InitializeComponent();
         }
        Runtime nui = new Runtime();//初始化
        
      
        
        private void Grid_Loaded(object sender, RoutedEventArgs e) //读取
        {
    
          nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth);//RGB数据 深度数据
          nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);//RGB
          //nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady);//深度数据
          nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
          //nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.Depth);
          
    
    
        }
    
        void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)//深度数据
        {
          throw new NotImplementedException();
        }
    
        void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)//RGB
        {
          PlanarImage imageData = e.ImageFrame.Image; image1.Source = BitmapSource.Create(imageData.Width, imageData.Height, 96, 96,
          PixelFormats.Bgr32, null, imageData.Bits, imageData.Width * imageData.BytesPerPixel);
        }
    
    
    
           private void Window_Closed(object sender, EventArgs e) { nui.Uninitialize(); }  
      
      }
     
       
    
      
       
       
    
     }
     
       
    
    


     

    Sunday, July 3, 2011 4:24 PM

Answers

  • Have you verified that all code gets executed as you'd expect by setting breakpoints? E.g.: Does Grid_Loaded function get called during app initialization and get fully executed, or is there an exception thrown? Also, does nui_VideoFrameReady method get called as expected and also not generate exceptions? What does the debug output look like?

    Eddy


    I'm here to help
    • Marked as answer by jiadancong Friday, July 8, 2011 6:33 AM
    Thursday, July 7, 2011 12:41 AM

All replies

  • Have you verified that all code gets executed as you'd expect by setting breakpoints? E.g.: Does Grid_Loaded function get called during app initialization and get fully executed, or is there an exception thrown? Also, does nui_VideoFrameReady method get called as expected and also not generate exceptions? What does the debug output look like?

    Eddy


    I'm here to help
    • Marked as answer by jiadancong Friday, July 8, 2011 6:33 AM
    Thursday, July 7, 2011 12:41 AM
  • Problem-solving Grid_Loaded in XMAL where no implementation, modificationWindow_Loaded success. Thank you!
    Friday, July 8, 2011 6:33 AM