I am using Aforge .NET framework to get a webcam in my app but I always get an all gray image frame.
this.videoSource = new VideoCaptureDevice(this.Moniker);
this.videoSource.DesiredFrameSize = GetHighestResolution(this.videoSource.VideoCapabilities);
this.videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame);
this.videoSource.Start();
The vent handler:
private void videoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
this.outputBox.Image = (Bitmap)eventArgs.Frame.Clone();
}
This should do the trick. DesiredFrameSize
is set to the highest value the cam can support.
Any hints why the image is always gray? Even when writing it do disk...
Edit: To add: The same problem occurs with the sample application SimplePlayer from Aforge samples. My webcam is a Logitech QuickCam Pro 9000.
Edit2: The same goes for small DesiredFramesizes
.