0

I know there are many related questions 1, 2, etc but they didn't help me to read a frame. I have an IP camera that is connected to the Ethernet socket of my laptop with a Cat6 cable. and the camera is connected to the power supply as well. I want to read the camera using OpenCV. I surfed the internet to find out the solution but it seems (but not mentioned) that they use a router or internet to access the camera. My camera is directly connected to the laptop and I want to store the frame to a Mat. How can I do this? In addition, I read somewhere that camera's driver is a need. Here is the simplified version of my problem. If I use 0 instead of the URL it works. The URL is my problem. I can not access the URL using Web browser.

public static void main(String[] args) {

        // load openCV libraries
        nu.pattern.OpenCV.loadShared();
        System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
        VideoCapture cam = new VideoCapture ("rtsp://192.168.1.171/video.mpeg"); // I also tested some http URLs

        Mat frame = new Mat();

        if (cam.isOpened())
            System.out.println("IP Camera is open");

        cam.read(frame);

        Imgcodecs.imwrite("IPCAM.jpg", frame);

        System.out.println("finished");


    }

Using Fedora, Java 9, Eclipse, maven

Amiri
  • 2,417
  • 1
  • 15
  • 42
  • Are you using a crossover Ethernet cable? – SeverityOne Apr 04 '18 at 20:20
  • Have you manually assigned IP address to your laptop Ethernet interface and the Camera? Also you would need to use a cross-over Ethernet cable. – D-Dᴙum Apr 04 '18 at 20:21
  • I tested the cable in the store. It worked there. – Amiri Apr 04 '18 at 20:22
  • Let me check if the cable is cross-over – Amiri Apr 04 '18 at 20:22
  • All the colors are in the same order on both ends. It is not crossover, is it? very sad – Amiri Apr 04 '18 at 20:27
  • @Kerry, I didn't get the point. manually assign the IP address? – Amiri Apr 04 '18 at 20:30
  • The seller said that the IP is 192.168.1.171 – Amiri Apr 04 '18 at 20:31
  • Can you ping that address? – glenebob Apr 04 '18 at 20:39
  • @glenebob, No, it's unreachable `PING 192.168.1.171 (192.168.1.171) 56(84) bytes of data. From 192.168.1.101 icmp_seq=1 Destination Host Unreachable From 192.168.1.101 icmp_seq=2 Destination Host Unreachable` – Amiri Apr 04 '18 at 20:59
  • @Martin not to sound condescending but I think you will need to understand Ethernet networking a little better. With Ethernet devices it's not just a matter of plugging them together. There are issues of address allocation, sub-networks etc and you haven't given any indication of how the IP address of your laptop has been set so I am assuming you haven't done this manually. You might want to refer to something like this http://www.steves-internet-guide.com/basic-networking-course/ to get a better understanding. – D-Dᴙum Apr 06 '18 at 07:25
  • Finally, I've bought a crossover cable, configured the ethernet device and ping the Camera's IP. It seems OK and the IP is reachable. But, I can't access the camera manager to see the streams. In `FireFox` I can see the login form only when I refresh the page. In MS Edge It needs a plugin. But, I'm a Linux user and Firefox is my fav. What should I do Now? – Amiri Apr 09 '18 at 08:19
  • @Kerry, Thank you. I reconfigured the network setting now my Laptop IP is `192.168.1.2`, and netmask is `255.255.255.0` and the camera is `192.168.1.171` – Amiri Apr 09 '18 at 08:24
  • I'm not sure what you are asking now. You say you can ping the camera and also browse to the camera's web interface in Firefox. So what isn't working now? – D-Dᴙum Apr 09 '18 at 12:09
  • @Kerry, I can ping the camera IP, but I can not browse the web interface. I only can see the login form for a moment and it disappears. If I refresh the page again for a moment. I tested in MS Edge and it needs a plugin for the first time but in Firefox there isn't such a message to install a plugin. I have installed some plugins for IP camera, but they are not the answer. The question is what is the plugin to see the web interface in Firefox? – Amiri Apr 09 '18 at 15:54
  • You question is now not related to writing code. You are asking for technical support or advice about your camera. You need to refer to the camera manufacturer's website/support for further details. – D-Dᴙum Apr 10 '18 at 12:38
  • I want to see the streams and I think the web interface can help. if you have any other suggestion, I appreciate it. – Amiri Apr 10 '18 at 12:39
  • @kerry I want to use the web interface to see the stream URL – Amiri Apr 10 '18 at 12:41
  • This question is not off-topic. It's about programming. I only wanted to see if the camera is working to solve my programming problem. – Amiri Apr 10 '18 at 14:08

0 Answers0