I need to convert webcam-picture (retrieved by AForge) to a BitmapImage in order to use it as a source for the WPF Image-control.
The following source is working but it runs with only like 5-7 FPS on a 3rd Gen i7.
Are there better alternatives to improve the speed?
    void videoSource_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
    {
        System.Drawing.Image img = eventArgs.Frame;
        BitmapImage bitmapImage;
        using (MemoryStream memory = new MemoryStream())
        {
            img.Save(memory, ImageFormat.Bmp);
            bitmapImage = new BitmapImage();
            bitmapImage.BeginInit();
            memory.Seek(0, SeekOrigin.Begin);
            bitmapImage.StreamSource = memory;
            bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
            bitmapImage.EndInit();
        }
        bitmapImage.Freeze();
        Dispatcher.BeginInvoke(new ThreadStart(delegate
        {
            outputImage.Source = bitmapImage;
        }));
    }
