Unable to use VideoCapture to access axis m1013 (Java)

asked 2016-12-22 13:26:16 -0600

JT gravatar image

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

edit retag flag offensive close merge delete

Comments

please check the return value from vc.open()

also, make sure, opencv_ffmpeg.dll is on the PATH (or next to your binnary)

berak gravatar imageberak ( 2016-12-23 01:15:24 -0600 )edit