C#显示摄像头预览

 IntPtr p = Emgu.CV.CvInvoke.cvCreateCameraCapture(-1);
                IntPtr frame;
                while ((frame = Emgu.CV.CvInvoke.cvQueryFrame(p)) != IntPtr.Zero)
                {
                    MIplImage iplImage = (MIplImage)Marshal.PtrToStructure(frame, typeof(MIplImage));
                    Emgu.CV.Image<Bgr, byte> image = new Image<Bgr, byte>(iplImage.width, iplImage.height, iplImage.widthStep, iplImage.imageData);
                    this.pictureBox1.Image = image.Bitmap;
                    System.Threading.Thread.Sleep(10);
                    Application.DoEvents();
                }
posted @ 2011-03-25 17:41  81  阅读(2145)  评论(0编辑  收藏  举报