I'm using some code to show live video from a camera.
In Windows Form (C#) the code worked fine, but in WPF application i getting an error in :
Bitmap img = (Bitmap)eventArgs.Frame.Clone();
Image.Source = img;
the error was : connot convert System.Drawing.Bitmap to System.Wondows.Media.ImageSource. So i converted the Bitmap image using this code:
public ImageSource imageSourceForImageControl(Bitmap BitmapImage)
{
ImageSourceConverter SourceImage = new ImageSourceConverter();
return (ImageSource)SourceImage.ConvertFrom(BitmapImage);
}
Then i got a System.NullReferenceException
Any idea what should i do??
PS : Im a Newbie with C# applications