Samsung SNZ 6320P not streaming

asked 2015-12-08 06:01:28 -0500

Waqar gravatar image

I am trying to get the stream of camera in my application. The link which I am using is giving stream in VLC player but when I use the same link it gives me error

Error

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0
    at java.awt.image.SampleModel.<init>(SampleModel.java:108)

Currently, I am using opencv to stream my frames. Code is as under:-

public void captureFrame() {

        System.out.println("Hello, OpenCV");
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        VideoCapture camera = new VideoCapture();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
              System.out.println(e.toString());
            e.printStackTrace();
        }
        camera.open("http://admin:SAMSUNG~1@192.168.1.121/cgi-bin/video.cgi?msubmenu=mjpg"); //Useless
        if(!camera.isOpened()){
            System.out.println("Camera Error");
        }
        else{
            System.out.println("Camera OK?");
        }
        Mat frame = new Mat();
        camera.read(frame);
        System.out.println("Frame Obtained");
        bi=MatToBufferedImage(frame);
        camera.release();
      //  Imgcodecs.imwrite("C:\\Users\\Umar\\Desktop\\MyFolder\\javaanpr\\javaanpr\\camera.jpg", frame);
    }//captureFrame

is something required in the above code or am I missing some step?

edit retag flag offensive close merge delete

Comments

unfortunately, opencv's android api does neither support capture from streaming urls, nor from file.

berak gravatar imageberak ( 2015-12-08 07:04:41 -0500 )edit

This is not android Api exception, Its Java OpenCv Lib Exception

Waqar gravatar imageWaqar ( 2015-12-08 21:18:38 -0500 )edit