Windows.Media.Capture and Kinect v2 RRS feed

  • Question

  • Hello,

    can someone explain me if it's possible to add Windows.Media.Capture namespace to a Kinect-WPF project? I need it in order to save RGB stream using ScreenCapture (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642093.aspx). I didn't found how to install these API and add them as reference in my project.

    Thanks in advance!

    Friday, September 5, 2014 2:46 PM


All replies

  • Windows.Media.Capture is a WinRT API. If you want to consume it from your WPF project, there is a blog post about it.
    Friday, September 5, 2014 5:23 PM
  • Thanks for your answer, I've followed blog's instructions and it seems to work now! :-)
    Monday, September 8, 2014 8:42 AM
  • I've tried the solution proposed by the blog, it works quite well but the kinect is used as a normal webcam by the code... Is it possible to directly save Kinect RGB stream in a file? (following in general this solution: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642092.aspx).

    Thanks in advance!

    Tuesday, September 9, 2014 12:26 PM
  • Kinect is not exposed as a web cam to the system, but the Kinect SDK has api's to provide the color frame data as RGB.

    Carmine Sirignano - MSFT

    Tuesday, September 9, 2014 8:30 PM
  • Thanks for your reply, but my question was different (probably I've not explained well). I've a WPF application that gives me as output RGB stream from Kinect. I need to save this stream in an .avi file in order to use it in another application. I've tried to use VideoCapture to write .avi file but Kinect RGB real time stream slows down (24 fps instead of 30 fps). For this reason, I've started to use CameraCapture's API, but they record stream gives by a webcam (in my case, the Kinect used as a webcam with ManyCam). I need instead to directly put Kinect's stream (shown as a WriteableBitmap) in .avi file as I've already tried to do previously with VideoCapture, in order to record RGB stream and not to slow down real time visualization frame rate.

    For my project, I used ColorBasic-WPF sample for Kinect v2 and MediaCapture API (following this tutorial: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642092.aspx ).

    I hope I explained myself better this time! Thanks in advance!

    Wednesday, September 10, 2014 11:59 AM
  • Can the AviFile wrapper help you with this?
    Thursday, September 11, 2014 10:41 PM
  • Thanks for your answer, I try to implement the code you suggested with AviFile library but, as with VideoCapture, the Kinect RGB stream is not visualized in real time (frame rate slows down approssimatively to 10 fps). This is probably do to real time compression of .avi file, but if I don't compress frame my application reach "out of memory" in few seconds (because each Kinect frame is HD1080p). Other ideas to save .avi file or do a screen capture? Thanks!
    Monday, September 15, 2014 2:12 PM
  • I see two solutions: a) Save your rgb stream to a file, and encode it later; b) buffer frames before feeding them to the encoder.

    Common approach is (b), where you maintain a circular frame buffer, so you won't get OOM. It also looks that your encoder is slow, so you may have noticeable video glitches.

    VlcDotNet has a BitmapSource, so you can play with it and choose the best compression method for you.

    Monday, September 15, 2014 4:09 PM
  • I download VlcDotNet and I'm starting to integrate it in my C# WPF project, but I cannot find any example about how to record a Bitmap (or WriteableBitmap) and put it in a file. Could you post an example or link? Sorry but I'm new to C#... Thanks so much!
    Wednesday, September 17, 2014 2:44 PM
  • maybe you could use videoWriter from egmu/opencv or videoFileWriter from aForge library
    Wednesday, August 19, 2015 1:06 PM
  • Dear ChiaSi,

    I have the same problem as you, have you found some solution?

    Tuesday, April 26, 2016 4:45 PM