简体   繁体   中英

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. I've tried different sample code found online and in the OpenCV documentation but I still get the error. 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)?

I'm using OpenCV 2.4.5 and VisulaStudio 2012.


Solved

I've downloaded VSFilter.dll and replaced the original one in Windows/system32/, now everything work!

any chance, you ended up in "dll hell" ?

like:

  1. linking release code against debug dll's ( or the other way round )
  2. linking 32bit code against 64bit dll's ( or the other way round )
  3. linking vc9 code against vc10 dll's ( .. i hope, you get the pattern, now )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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