1,安装EMgu
2,调用摄像头
public FaceLoad(){InitializeComponent();try{capture = new Capture();capture.Start();//摄像头开始工作capture.ImageGrabbed += frameProcess;//实时获取图像}catch (NullReferenceException excpt){//MessageBox.Show(excpt.Message);}}
private void frameProcess(object sender, EventArgs arg){//Thread.Sleep(3000);matImg = new Mat();capture.Retrieve(matImg, 0);frame=new Image<Bgr, byte>(matImg.Bitmap); picShow.Image = frame;}
3,效果如下