Opencv Videocapture cannot get stream

asked 2016-02-01 16:57:43 -0600

updated 2020-01-13 20:53:04 -0600

supra56 gravatar image

hey i have the following code but the link that im using seems that it will not work no matter what i try to do im using opencv 3.0 any help would be appreciated. Thanks in advance.

import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class VideoCap {
    public static void main (String args[]){
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        VideoCapture camera = new VideoCapture("http://86.45.26.248:8080/?action=stream?dummy=param.mjpg");
        if(!camera.isOpened()){
            System.out.println("Error");
        }
        else {
            Mat frame = new Mat();
            while(true){
                if (camera.read(frame)){
                    System.out.println("Frame Obtained");
                    System.out.println("Captured Frame Width " + 
                    frame.width() + " Height " + frame.height());
                    Imgcodecs.imwrite("camera.jpg", frame);
                    System.out.println("OK");
                    break;
                }
            }   
        }
        camera.release();
    }
}
edit retag flag offensive close merge delete