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();
}
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();
}