Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Java, OpenCV, & an Axis Camera (cannot open connection)

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it (running windows 7 x64).

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears not to work for me.

Here's what I have:

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

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

        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }
}

But the connection never opens, here's the output:

Welcome to OpenCV 2.4.10.0 
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.

click to hide/show revision 2
Same result in python

Java, OpenCV, & an Axis Camera (cannot open connection)

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it (running windows 7 x64).

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears not to work for me.

Here's what I have:

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

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

        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }
}

But the connection never opens, here's the output:

Welcome to OpenCV 2.4.10.0 
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.

UPDATE #1: I installed python and had the same problem, here's the code:

import cv2
cam = cv2.VideoCapture("http://10.25.86.11/mjpg/video.mjpg")
cam.isOpened()

Returns false.

OpenCV, & an Axis Camera (cannot open connection)

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it (running windows 7 x64).

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears not to work for me.

Here's what I have:

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

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

        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }
}

But the connection never opens, here's the output:

Welcome to OpenCV 2.4.10.0 
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.

UPDATE #1: #1:

I installed python and had the same problem, here's the code:

import cv2
cam = cv2.VideoCapture("http://10.25.86.11/mjpg/video.mjpg")
cam.isOpened()

Returns false.

UPDATE #2:

As an update, I found this chunk of code, and it showed the video feed: http://www.chiefdelphi.com/forums/sh...96&postcount=3

Although that snippet is in python, that's one step closer to solving the mystery here. I still want to know how to use the opencv VideoCapture class so that I can program in Java, suggestions very much appreciated.

OpenCV, & an Axis Camera (cannot open connection)

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it (running windows 7 x64).

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears not to work for me.

Here's what I have:

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

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

        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }
}

But the connection never opens, here's the output:

Welcome to OpenCV 2.4.10.0 
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.

UPDATE #1:

I installed python and had the same problem, here's the code:

import cv2
cam = cv2.VideoCapture("http://10.25.86.11/mjpg/video.mjpg")
cam.isOpened()

Returns false.

UPDATE #2:

As an update, I found this chunk of code, and it showed the video feed: http://www.chiefdelphi.com/forums/sh...96&postcount=3

Although that snippet is in python, that's one step closer to solving the mystery here. I still want to know how to use the opencv VideoCapture class so that I can program in Java, suggestions very much appreciated.

UPDATE #3 The solution for Python was on: https://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows/24211998#24211998

But I still need a solution for java....

OpenCV, & an Axis Camera (cannot open connection)

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it (running windows 7 x64).

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears not to work for me.

Here's what I have:

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

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

        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }
}

But the connection never opens, here's the output:

Welcome to OpenCV 2.4.10.0 
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.

UPDATE #1:

I installed python and had the same problem, here's the code:

import cv2
cam = cv2.VideoCapture("http://10.25.86.11/mjpg/video.mjpg")
cam.isOpened()

Returns false.

UPDATE #2:

As an update, I found this chunk of code, and it showed the video feed: http://www.chiefdelphi.com/forums/sh...96&postcount=3

Although that snippet is in python, that's one step closer to solving the mystery here. I still want to know how to use the opencv VideoCapture class so that I can program in Java, suggestions very much appreciated.

UPDATE #3 The solution for Python was on: https://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows/24211998#24211998

But I still need a solution UPDATE #4 I finally have it working in Java and python. I simply copied opencv/sources/3rdparty/ffmgeg/opencv_ffmpeg_64.dll to c:\windows\system32\opencv_ffmpeg2410_64.dll and ran the java application and it worked as expected~!

(I'm apparently not allowed to add an answer to my own question for java....another day, so I'll just leave this here in case I forget.)