Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
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
Posted

1 solution

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
 
Share this answer
 
Comments
Member 11090261 18-Sep-14 1:45am    
Then how i can read video frame by frame from my hard drive. i am using opencv in java. any solution.
Sergey Alexandrovich Kryukov 18-Sep-14 2:38am    
I found where your bug is; the rest of it is a different question. Are you going to accept this answer formally?
Now, usually, video is not read frame from frame. Are those the frames without video compression? If so, why?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900