Ask Your Question

Revision history [back]

Unable to use VideoCapture to access axis m1013 (Java)

Hello, I am trying to use VideoCapture in Java to access the stream from an Axis m1013. The code does not return me any errors, but it will not affirm that the camera stream has been opened either. I tried using it to grab a single jpeg from the stream, rather than accessing the video, but this seems to not work, either. vc.isopen() does not return true. My code as of right now is:

package camTest;

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

 public class CamTestMain {

public static void main(String[] args) {
    VideoCapture vc;
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    vc = new VideoCapture();

    try
    {
        vc.open("http://axis-camera-223-catapult.lan/mjpg/video.mjpg");
        System.out.println("no err");

        Mat frame = new Mat();

        vc.read(frame);

        Highgui.imwrite("C:/dmp.jpg", frame);


    } catch (Exception e)
    {
        System.out.println("error opening cam. details:  ");
        e.printStackTrace();
    }

    if(vc.isOpened())
        System.out.println("cam opened");

}

}

I'm using OpenCV version 2.4.13, and JDK 8u101. I have verified that the rescources exist through a browser using the URL HTTP://<ip>/mjpg/video.mjpg. I have installed ffmpeg, but i don't know any way to verify it works properly or is installed correctly. I can access the camera configuration through a browser, also, and get a jpeg image through HTTP://<ip>/jpg/image.jpg. Any help would be much appreciated, as I've been working at this for quite some time. Thanks, JT