Example #1
0
 public void FrameCallBack(IntPtr hwnd, ref VIDEOHEADER hdr)
 {
     bmp = new Bitmap(CaptureWidth, CaptureHeight, CaptureWidth * 3, System.Drawing.Imaging.PixelFormat.Format24bppRgb, hdr.lpData);
     //flip the image, the image is captured upside down
     bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
     FrameCaptured(this, new WebCameraEventArgs(bmp));
 }
Example #2
0
        public void FrameCallBack(IntPtr hwnd, ref VIDEOHEADER hdr)
        {
            try
            {
                bmp = new Bitmap(CaptureWidth, CaptureHeight, 3 * CaptureWidth, System.Drawing.Imaging.PixelFormat.Format24bppRgb, hdr.lpData);
                //image is captured upside down so flip
                bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);

                if (bmp.Width > 320 && bmp.Height > 240)
                {
                    Bitmap resizedBitmap = new Bitmap(bmp, new Size(320, 240));
                    RaiseFrameCapturedEvent(new CameraEventArgs(this, resizedBitmap));
                }
                else
                {
                    RaiseFrameCapturedEvent(new CameraEventArgs(this, bmp));
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.Out.WriteLine("USBDevice: " + ex.Message);
#endif
            }
        }
        private void FrameCallBack(IntPtr hwnd, ref VIDEOHEADER hdr)
        {
            if (OnCameraFrame != null)
             {
            Bitmap bmp = new Bitmap(frameWidth, frameHeight, 3 * frameWidth, System.Drawing.Imaging.PixelFormat.Format24bppRgb, hdr.lpData);
            OnCameraFrame(this, new WebCameraEventArgs(bmp));
             }

             // block thread for preferred milleseconds
             if (preferredFPSms == 0)
            autoEvent.WaitOne();
             else
            autoEvent.WaitOne(preferredFPSms, false);
        }