Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Connect to public IP camera in Java

I'm trying to connect to a public IP camera (http://iris.not.iac.es/axis-cgi/mjpg/video.cgi?resolution=320x240) in Java by using the following:

import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class Main
{
    public static void main(String[] args)
    {
        System.out.println("Welcome to OpenCV " + Core.VERSION);
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

        VideoCapture ip_cam = new VideoCapture();

        ip_cam.open("http://iris.not.iac.es/axis-cgi/mjpg/video.cgi?resolution=320x240");

        if (!ip_cam.isOpened())
        {
            System.out.print("Error while trying to open the webcam");
            return;
        }


        System.out.println("Success!");

        ip_cam.release();
    }
}

However, it refuses to open. It doesn't throws any error messages nor anything. I've tried running it as admin, downgrading from OpenCV 3.0.0 to 2.4.11, trying to connect to a different IP camera.. nothing. Since it's such a simple program I just can't figure out what's wrong.

I'm using OpenCV 3.0.0, Eclipse Mars 1 4.5.1 and Win7 64bits.