从硬盘驱动器逐帧读取视频使用java中的opencv给出错误 [英] read video frame by frame from hard drive giving error using opencv in java

查看:154
本文介绍了从硬盘驱动器逐帧读取视频使用java中的opencv给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I want to read video from drive frame by frame. I am using opencv in java.

<pre lang="java">VideoCapture camera=new VideoCapture("video path");// giving error on this line.

Mat frame = new Mat();

while(true){
    if (camera.read(frame)){
        Highgui.imwrite("F:/camera.jpg", frame);
        break;
    }
    else
        break;</pre>

the above code is giving this error

Exception in thread "main" java.lang.Error: Unresolved compilation problem: The constructor VideoCapture(String) is undefined

推荐答案

这个问题没有什么高科技。您正在尝试使用不存在的 VideoCapture 构造函数。从错误消息中不是很明显吗?你试图通过一些神秘的字符串类型的参数,视频路径,很难理解为什么目的。



如果你看一下原来的OpenCV文档,你会发现只有两个构造函数,一个没有参数,另一个期望 int 参数:

http://docs.opencv.org/java/org/opencv/highgui/VideoCapture.html [ ^ ]。



就是这样。



-SA
There is nothing high-tech in this problem. You are trying to use non-existing VideoCapture constructor. Wasn't that quite obvious from the error message? You are trying to pass some mysterious argument of the string type, "video path", hard to understand for what purpose.

If you look at the original OpenCV documentation, you will find only two constructors, one without parameters, another one expecting int parameter:
http://docs.opencv.org/java/org/opencv/highgui/VideoCapture.html[^].

That's all.

—SA


这篇关于从硬盘驱动器逐帧读取视频使用java中的opencv给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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