简体   繁体   English

从相机读取时C ++ OpenCV 0xC0000005错误

[英]C++ OpenCV 0xC0000005 error while reading from camera

As said I get a 0xC0000005 reading access violation error realted to VSFilter.dll when I try to get a frame from the camera. 如前所述,当我尝试从相机获取帧时,收到了一个0xC0000005读取访问冲突错误,该错误已呈现到VSFilter.dll。 I've tried different sample code found online and in the OpenCV documentation but I still get the error. 我尝试了在线和OpenCV文档中找到的其他示例代码,但仍然收到错误。 For example this is the code I'm using now: 例如,这是我现在使用的代码:

#include <opencv/cv.h>
#include <opencv/highgui.h>

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0);

    if(!cap.isOpened()) return -1;

    Mat frame;

    namedWindow("Camera",1);

    while(1)
    {
        cap >> frame;

        imshow("Camera", frame);

        if(waitKey(30) >= 0) break;
    }

    return 0;
}

And in the output there are this two errors (a first-chance exeption and an unhandled exeption, sorry for the italian): 在输出中有两个错误(第一个机会出局和未处理的出局,对不起意大利人):

Eccezione first-chance in 0x000007FEEB115791 (VSFilter.dll) in OpenCV.exe: 0xC0000005: violazione di accesso durante la scrittura del percorso 0x000000000468E000.
Eccezione non gestita in 0x000007FEEB115791 (VSFilter.dll) in OpenCV.exe: 0xC0000005: violazione di accesso durante la scrittura del percorso 0x000000000468E000.

So the code is pretty simple and it shouldn't be the problem, I am wondering why the error is related to VSFilter.dll (VobSub & TextSub filter for DirectShow/VirtualDub/Avisynth)? 所以代码很简单,不应该是问题,我想知道为什么错误与VSFilter.dll(DirectShow / VirtualDub / Avisynth的VobSub和TextSub过滤器)有关?

I'm using OpenCV 2.4.5 and VisulaStudio 2012. 我正在使用OpenCV 2.4.5和VisulaStudio 2012。


Solved 解决了

I've downloaded VSFilter.dll and replaced the original one in Windows/system32/, now everything work! 我已经下载了VSFilter.dll并替换了Windows / system32 /中的原始文件,现在一切正常!

any chance, you ended up in "dll hell" ? 有机会,您最终陷入“ dll地狱”吗?

like: 喜欢:

  1. linking release code against debug dll's ( or the other way round ) 针对调试DLL链接发布代码(或反过来)
  2. linking 32bit code against 64bit dll's ( or the other way round ) 将32位代码与64位dll链接起来(或者反过来)
  3. linking vc9 code against vc10 dll's ( .. i hope, you get the pattern, now ) 将vc9代码与vc10 dll链接起来(..我希望您现在就可以得到该模式)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM