OpenCV Java从静默的文件失败中绑定VideoCapture [英] OpenCV Java binds VideoCapture from file failing silently

查看:458
本文介绍了OpenCV Java从静默的文件失败中绑定VideoCapture的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OpenCV 2.4.8与提供的Windows 64位Java jar。我在目前的环境中一直充分利用OpenCV,直到这一点。



我无法使用
VideoCapture 打开视频文件,但是摄像头Feed工作正常



下面的作品与 video.isOpened 返回true

  VideoCapture video = new VideoCapture(); 
boolean result = video.open(0);

以下失败与 video.isOpened 返回false

  VideoCapture video = new VideoCapture(); 
boolean result = video.open(res / hand-test-1.mp4);

两种文件格式似乎都有所不同(这些都是转换的,而不仅仅是希望重命名) p>

  video.open(res / hand-test-1.mp4); 
video.open(res / hand-test-1.avi);
video.open(res / hand-test-1.wmv);

位置似乎也不重要。

  video.open(C:/hand-test-1.mp4); 
video.open(C:\\hand-test-1.mp4);
video.open(hand-test-1.mp4);

无论是垃圾还是从OpenCV通过Java引发的异常,似乎都无声地失败。 p>

  video.open(ashdkfhkajsjdfkhaksdf); 

PATH包含opencv安装附带的ffmpeg目录,

  C:\dev\opencv\sources\3rdparty\ffmpeg 

现在我用完了想法,看起来像我通过 video.open(String)返回false。



任何帮助将不胜感激

解决方案

与OpenCV 2.4.9有同样的问题。将PATH变量设置为OpenCV安装目录的bin目录的固定方法,例如C:\opencv\build\x64\vc11\bin。


I'm using OpenCV 2.4.8 with the supplied Windows 64bit Java jar. I've been making full use of OpenCV in my current environment up until this point.

I'm unable to open video files using the VideoCapture class however webcam feeds work just fine.

The below works as expected with video.isOpened returning true

    VideoCapture video = new VideoCapture();
    boolean result = video.open(0);

The below fails with video.isOpened returning false

    VideoCapture video = new VideoCapture();
    boolean result = video.open("res/hand-test-1.mp4");

Neither file formats seems to make a difference (These are converted, not just renamed in hope)

    video.open("res/hand-test-1.mp4");
    video.open("res/hand-test-1.avi");
    video.open("res/hand-test-1.wmv");

Location seems to matter not either.

    video.open("C:/hand-test-1.mp4");
    video.open("C:\\hand-test-1.mp4");
    video.open("hand-test-1.mp4");

Neither does garbage, no exception kicked up from OpenCV through Java either, seems to fail silently.

    video.open("ashdkfhkajsjdfkhaksdf");

PATH contains the ffmpeg directory supplied with the opencv installation,

    C:\dev\opencv\sources\3rdparty\ffmpeg

Right now I've run out of ideas, it seems like whatever I throw to the native via video.open(String) will return false.

Any help would be much appreciated

解决方案

I had the same problem with OpenCV 2.4.9. The solution that fixed things lied in setting the PATH variable to the "bin" directory of the OpenCV installation directory, for example "C:\opencv\build\x64\vc11\bin".

这篇关于OpenCV Java从静默的文件失败中绑定VideoCapture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆