【问题标题】:Attempted to read or write protected memory when capture video using Emgu-CV使用 Emgu-CV 捕获视频时尝试读取或写入受保护的内存
【发布时间】:2015-07-05 22:37:49
【问题描述】:

我尝试使用 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"); 

谢谢。

详情

【问题讨论】:

  • 您可以发布异常详细信息以供审核吗?
  • @MichaelDiFelice,我在上面添加了详细信息。
  • 对不起,应该更清楚,您可以将 StackTrace 添加到问题详细信息中吗?很难看到,但它看起来好像在 CreateFileCapture(string filename) 上失败了。文件是否存在?也许这是 Emgu CV 中的一个已知问题。
  • 刚刚发现这篇博客文章讨论了这个问题:emgu.com/forum/viewtopic.php?f=2&t=1523 似乎这个错误在 OpenCV 2.2 中。也许尝试从 SVN 存储库获取最新的并再次尝试?
  • 除非你必须这样做。使用最新版本的 OpenCV。

标签: c# visual-studio opencv emgucv


【解决方案1】:

您不应该在您的 Capture 对象实例化之前启动您的计时器。 它可能会在加载 avi 视频之前查询帧。

试着换行:

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

【讨论】:

    猜你喜欢
    • 2010-10-10
    • 1970-01-01
    • 2021-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多