![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Codeprivate void button1_Click(object sender, EventArgs e) { Emgu.CV.Capture cap = new Capture("d:\1.wmv"); Emgu.CV.VideoSurveillance.BGStatModel<Bgr> bg = null; ; Capture c = new Capture("d:\1.wmv"); Image<Bgr, byte> img = null; while ((img = c.QueryFrame()) != null) { this.count++; if (this.count == 1) { bg = new Emgu.CV.VideoSurveillance.BGStatModel<Bgr>(img, Emgu.CV.CvEnum.BG_STAT_TYPE.GAUSSIAN_BG_MODEL); } else { //更新高斯模型 bg.Update(img); this.pictureBox1.Image = img.Bitmap; this.pictureBox2.Image = bg.BackgroundMask.Bitmap; this.pictureBox3.Image = bg.ForgroundMask.Bitmap; Application.DoEvents(); System.Threading.Thread.Sleep(30); } } }