AndyCai
AndyCai

Reputation: 1

Save the captured Kinect images without increasing the memory

I'm a newbie in C# and Kinect. Currently, I'm working on a project which requires saving the incoming Kinect v2 frames into a local directory. I use the following codes to save the captured images. However, while I open the Task Manager during the program running, it seems that the occupied memory keeps rising up rapidly. Is there a way to lower the occupied memory?

a = SaveCombinedTimestamps.GetEnumerator();
        foreach (BitmapSource node in SaveCombinedFrames)
        {
            a.MoveNext();
            PngBitmapEncoder enc = new PngBitmapEncoder();
            enc.Frames.Add(BitmapFrame.Create(node));
            string temppath = System.IO.Path.Combine(@"../test/color/", a.Current + ".png");
            using (System.IO.FileStream fs = new System.IO.FileStream(temppath, System.IO.FileMode.Create))
            {
                enc.Save(fs);
                fs.Close();
            }
        }

Upvotes: 0

Views: 52

Answers (0)

Related Questions