I am working with Aforge.Net to get a single frame from webcam and display it through image control. whenever a user clicks the button i am trying to update the image control with a new image, fetched from the webcam . Everything seems to work fine but the memory usage keeps on going up. I don't no how to fix this issue in my app.
Bitmap _image = aforge.Test();
WebCamVideo.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
_image.GetHbitmap()
, IntPtr.Zero
, System.Windows.Int32Rect.Empty
, BitmapSizeOptions.FromWidthAndHeight(
_image.Width
, _image.Height)
);
WebCamVideo.Source.Freeze();
_image.Dispose();