问题描述
我正在做一个项目,我正在从kinect捕获帧并对它们进行一些实时处理,我需要显示位图,所以我将它们转换为bmapsource并传递给image.source:Bitmap bmap =新的位图(640,480,System.Drawing.Imaging.PixelFormat.Format24bppRgb); BitmapSource bmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmap.GetHbitmap(),IntPtr.Zero,Int32Rect.Empty,BitmapSizeOptions.FromEmptyOptions()); image.source = bmapSource;
但是当我在2分钟后处理15FPS时,我得到了这部分的Out of memory错误。无论如何在每个过程之后清除内存?或者是否有任何其他方式在wpf中显示bmap?
提前致谢:)
I'm doing a project and I'm capturing frames from kinect and do some real-time process on them, I need to display bitmaps so I'm converting them to bmapsource and pass to image.source: Bitmap bmap = new Bitmap(640, 480, System.Drawing.Imaging.PixelFormat.Format24bppRgb); BitmapSource bmapSource= System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmap.GetHbitmap(),IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); image.source = bmapSource;
But as I'm processing 15FPS after 2 minute I get the error "Out of memory" for this part. Is there anyway to clear the memory after each process? or isthere any other way to display the bmap in wpf?
Thanks in advance :)
这篇关于如何在WPF中清除内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!