VideoCapture OpenCV 2.4.2 error in windows

后端 未结 5 1016
名媛妹妹
名媛妹妹 2020-12-10 07:38

I have a problem using VideoCapture class with OpenCV 2.4.2 under windows XP 32bits. It doesn\'t open any file or camera and fixing it\'s being a pain. Im using visual studi

相关标签:
5条回答
  • 2020-12-10 08:07

    See the fix I found below, for mp4 files. I faced the same issue on Windows 7, using OpenCV 2.4.9. I am using the java wrapper for opencv.

    Matthias Krings has done a lot of research for this. See this. Apparently this is an issue based on the video file type. With .avi files, it seems to work for a lot of people. Unfortunately his solution of setting OPENCV_DIR did not work for me. But his comments in the bug listing gave me a hint to fix the issue.

    You have to do two things:

    1. Set java.library.path to include the directory {opencv\install\dir}opencv-2.4.9\build\x86\vc10\bin. You can set the variable using the -D option on the java command line: java -Djava.library.path=PATH_TO_YOUR_DLL .... Also fetch this variable from your environment, using System.getProperty(...), and print it before calling loadLibrary(), to verify that the path setting is working.
    2. And in your java class, load the ffmpeg dll using System.loadLibrary("opencv_ffmpeg249");. The loadLibrary() function should be invoked from within a static block in java.
    3. There is a file named opencv_ffmpeg249.dll in the java.library.path that we set.
    4. This works on ubuntu also, for .so files.
    0 讨论(0)
  • 2020-12-10 08:13

    I also faced with this problem and solved it by correct the path of the function:

    VideoCapture cap(videoName);
    

    If the AVI file of videoName does't exist, it will be an error:

    (../../modules/highgui/src/cap_ffmpeg_impl.hpp:XXX)
    

    where XXX represents the line number.

    0 讨论(0)
  • 2020-12-10 08:16

    In my case, the same problem was resolved after deleting all opencv_***.dll files in C:\Windows\System32. So, I use the dll files just through the path like "%PATH%;C: \Program Files \OpenCV2.4.2\build\x86\vc10/bin". Please try it.

    0 讨论(0)
  • 2020-12-10 08:26

    I had the same issue with the open method whilst running under Windows 8 (64bit), opencv 2.4.10. IDE is running in x86.

    I found that running the application in release configuration solved the problem.

    Stumbled across the answer because I had the same issue with imread. Issue is presented in the this thread. imread not working in Opencv

    0 讨论(0)
  • 2020-12-10 08:27

    I too faced the same issue and resolved after pointing to the correct location of the input video.

    0 讨论(0)
提交回复
热议问题