none
How to take a Snapshot? RRS feed

  • Question

  • Hi all,

    i'm using the SDK Kinect and KinectColorViewer to show the image.

    How can i create a function to take a snapshot of the image in the KinectColorViewer?

    Thanks,

    Roger Ribeiro


    Saturday, May 5, 2012 4:56 PM

All replies

  • hi Roger,

    you can use Kinect toolkit to take the snashot. check this link, contains necessary code also.

    http://c4fkinect.codeplex.com/

    Hope this helps !

    Thanks,

    Bharat.

    Saturday, May 5, 2012 5:09 PM
  • Hi Bhart,

    I will try it.

    Thanks,

    Rogério Ribeiro

     
    Sunday, May 6, 2012 10:02 AM
  • Hi Roger,

    You can use the following method to take a snapshot

    void TakeSnapshot()
    {
    
    string fileName = "snapshot.jpg";
    if(File.Exists(fileName))
    {
    File.Delete(fileName);
    }
    using(FileStream savedSnapshot = new FileStream(fileName, FileMode.CreateNew))
    {
    BitmapSource image = (BitmapSource) VideoStreamElement.Source;
    JpegBitmapEncoder jpgEncoder = new JpegBitmapEncoder();
    jpgEncoder.QualityLevel = 70;
    jpgEncoder.Frames.Add(BitmapFrame.Create(image));
    jpgEncoder.Save(savedSnapshot);
    savedSnapshot.Flush();
    savedSnapshot.Close();
    savedSnapshot.Dispose();
    }
    
    }


    Thanks,
    MOHAMED A. SAKR | Software Development Lead Engineer | EgyptNetwork
    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members. Also try to Vote as Helpful

    • Proposed as answer by MohamedSakr Tuesday, May 8, 2012 2:03 PM
    Monday, May 7, 2012 9:00 AM
  • Hi,

    I implemented the code but it occurred to me a error on line jpgEncoder.Frames.Add (BitmapFrame.Create (image));

    This is due the fact that the property of  VideoStreamElement.Source is set to null.
    How can i binding my KinectColorViewer to the  VideoStreamElement.Source?

    Thanks,

    Roger Ribeiro

    Tuesday, June 5, 2012 11:04 PM