Using Directx.Capture; to Capture a picture from a Webcam (Capture the Frame from the Preview PictureBox). Displaying Length of that Frame is sometimes (rare) ok : around 25000 Most of the time is more than 10x larger, around 320000! Why is that? width and height always the same in both cases though!
private void startCap() {
public Filter VideoInput = null;
public Capture CaptureInfo = null;
public Filters InputOptions = new Filters();
this.VideoInput = this.InputOptions.VideoInputDevices[camNum];
this.CaptureInfo = new Capture(this.VideoInput, null);
this.CaptureInfo.PreviewWindow = pictureBox1;
this.CaptureInfo.RenderPreview();
this.CaptureInfo.FrameCaptureComplete += new Capture.FrameCapHandler(CaptureInfo_FrameCaptureComplete);
CaptureInfo.CaptureFrame();
}
void CaptureInfo_FrameCaptureComplete(PictureBox Frame)
{
Image nwImage = Frame.Image;
using (MemoryStream ms = new MemoryStream())
{
nwImage.Save(ms, ImageFormat.Png);
Debug.WriteLine("length "+ms.Length); //<===== length
ms.Close();
ms.Dispose();
}
}
Just saying, the ligter image with low length of 25000, is correct and displaying properly. And i would like to find where the problem comes from to keep the Frames ALWAYS around that size only. please help :)
Aucun commentaire:
Enregistrer un commentaire