访问违规读取位置 - opencv / VC ++

时间:2012-08-31 16:27:08

标签: c++ opencv

我在VC ++中使用OpenCV。该函数正在做它应该做的事情,但抛出一个异常,导致读取位置时导致访问冲突并引用ntdll.dll。当代码执行它应该做的事情时,我会因为无法处理异常而错过了什么?

void cl::first()
{
  Mat a=imread("C:\\1.jpg");
  Mat b;
  cvtColor(a,b,CV_RGB2BGR);
  imwrite("C:\\2.jpg",b);
  return ;
}

例外

First-chance exception at 0x77551e86 (ntdll.dll) in app.exe: 0xC0000005: 
Access violation reading location 0x43819ccc. Unhandled exception at 0x77551e86 (ntdll.dll) 
in app.exe: 0xC0000005: Access violation reading location 0x43819ccc. 
The program '[4500] app.exe: Native' has exited with code -1073741819 (0xc0000005).

1 个答案:

答案 0 :(得分:1)

我遇到了同样的错误,请检查

中的环境变量
  

控制面板 - >系统 - >高级系统设置 - >环境变量 - >路径

确保将opencv bin路径添加到环境“路径”,然后重新启动计算机

那应该有用

相关问题