Click here to Skip to main content
15,881,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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! (640x480)

C#
 public Filter VideoInput = null;
 public Capture CaptureInfo = null;
 public Filters InputOptions = new Filters();


 private void startCap(int camNum = 0) {
      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 :)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900