使用Emgu-CV捕获视频时尝试读取或写入受保护的内存

时间:2015-04-27 12:52:39

标签: c# visual-studio opencv emgucv

我尝试使用Emgu-CV捕获视频,但是我有一个错误。我的以下代码:

Timer My_Time = new Timer();
int FPS = 30;

public Form1()
{
       InitializeComponent();

       //Frame Rate
       My_Timer.Interval = 1000 / FPS;
       My_Timer.Tick += new EventHandler(My_Timer_Tick);
       My_Timer.Start();
       _capture = new Capture("test.avi");   
}

private void My_Timer_Tick(object sender, EventArgs e)
{
       imageBox.Image = _capture.QueryFrame();
}

错误发生在

_capture = new Capture("test.avi"); 

enter image description here

感谢。

详细 enter image description here

1 个答案:

答案 0 :(得分:1)

在Capture对象实例化之前,不应启动计时器。 可能是在加载avi视频之前查询帧。

尝试交换这一行:

_capture = new Capture("test.avi");
My_Timer.Start();