2016年7月6日 星期三
[emguCV]播放影片---臨時筆記(未整理)
先上code
Capture camCapter = null; int delay; Mat frame; Timer PlayerTimer = new Timer(); public Form1() { InitializeComponent(); try { camCapter = new Capture(@"影片位置"); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message); } camCapter.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.PosFrames, 2241); delay = (int)(1000 / (camCapter.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps))); PlayerTimer.Interval = delay; PlayerTimer.Tick += Time_Tick; } private void Time_Tick(object sender, EventArgs e) { if (frame != null){frame.Dispose();} frame = camCapter.QueryFrame(); if (frame == null) { Debug.WriteLine("Video End"); PlayerTimer.Stop(); } imageBox1.Image = frame; }
訂閱:
文章 (Atom)