Ask Your Question

Revision history [back]

Samsung SNZ 6320P not streaming

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:[email protected]/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?