Log in

View Full Version : How to access Axis camera feed with OpenCV


NWChen
29-01-2014, 00:29
Our team had some trouble accessing our IP camera's stream in OpenCV, so here's what we did in case other teams are having similar issues.

We are using OpenCV-2.4.8 and JavaCV-0.7 (https://code.google.com/p/javacv/).


IPCameraFrameGrabber grabber = new IPCameraFrameGrabber("http://YOUR_CAMERA'S_IP_ADDRESS/axis-cgi/mjpg/video.cgi?resolution=480x360&fps=INSERT_FPS_HERE");
grabber.start();


For example, our team (2601) has the following URL:
http://10.26.1.11/axis-cgi/mjpg/video.cgi?resolution=480x360&fps=100

Hope this helps.

Domenic Rodriguez
29-01-2014, 10:34
My team has also been working with OpenCV (using the official 2.4.7 Java bindings), and we have been using this URL successfully:

http://10.xx.yy.11/mjpg/video.mjpg

I wonder if there are any differences between the two URLs other than that you can specify camera settings in your URL.

Also, I'm curious as to your decision to use JavaCV now that OpenCV includes Java bindings. Would you say there is an advantage to using JavaCV over the official bindings, or does JavaCV supplement them?

NWChen
29-01-2014, 15:31
I wonder if there are any differences between the two URLs other than that you can specify camera settings in your URL.


We tried http://10.xx.yy.11/mjpg/video.mjpg but kept getting errors. This setup uses the M1011 with the DLink Rev A though.


Also, I'm curious as to your decision to use JavaCV now that OpenCV includes Java bindings. Would you say there is an advantage to using JavaCV over the official bindings, or does JavaCV supplement them?
We supplemented OpenCV with the JavaCV wrappers, but JavaCV had most of the functions we needed. Team 341's DaisyCV example used JavaCV so this was just a bit more convenient. I don't know about any other advantages.

charr
29-01-2014, 22:31
I'm trying to coax my daughter's team in the direction of OpenCV and wondered if you could share any more pointers or code samples.
Thanks,
Chris

My team has also been working with OpenCV (using the official 2.4.7 Java bindings), and we have been using this URL successfully:

http://10.xx.yy.11/mjpg/video.mjpg

I wonder if there are any differences between the two URLs other than that you can specify camera settings in your URL.

Also, I'm curious as to your decision to use JavaCV now that OpenCV includes Java bindings. Would you say there is an advantage to using JavaCV over the official bindings, or does JavaCV supplement them?

Domenic Rodriguez
30-01-2014, 00:34
I'm trying to coax my daughter's team in the direction of OpenCV and wondered if you could share any more pointers or code samples.
Thanks,
Chris

Let me prefix this post by stating that I've only been working with OpenCV for about a month, and am by no means an expert. This will be my team's first year using it. Nevertheless, here are some of the resources I've been using to learn OpenCV:

- The OpenCV documentation (http://docs.opencv.org) and tutorials (http://docs.opencv.org/doc/tutorials/tutorials.html) are well written and a great reference. The first class you will want to learn about is the Mat class (short for Matrix), which is what images are stored as. Then look into the Core, Imgproc, and Highgui modules.
- If you use the Java bindings of OpenCV, then you will want to refer to the Javadocs (http://docs.opencv.org/java)
- This (http://www.chiefdelphi.com/forums/showthread.php?t=123889) thread contains links to many valuable resources regarding OpenCV and vision processing.
- The ScreenSteps Live documentation has a section (http://wpilib.screenstepslive.com/s/3120/m/8731) that explains the algorithm that the sample vision code uses. Although it uses NI Vision as opposed to OpenCV, many of the principles still apply.
- DaisyCV (http://www.chiefdelphi.com/media/papers/2676), Team 341's 2012 vision code, is an excellent example of an FRC vision system built with OpenCV. Note that it is a SmartDashboard extension and uses WPIJavaCV, which differs a bit from modern OpenCV.

We'll likely be posting our code after the end of the season on GitHub (https://github.com/LuNaTeCs-316) (shameless self plug :rolleyes:), but if you'd like to see a sample of the code I have now to help you get started, send me a PM and I'll see what I can do.

NWChen
30-01-2014, 13:45
We'll likely be posting our code after the end of the season on GitHub (https://github.com/LuNaTeCs-316) (shameless self plug :rolleyes:), but if you'd like to see a sample of the code I have now to help you get started, send me a PM and I'll see what I can do.

Same here, I'm no expert either but feel free to PM me. OpenCV samples are in our GitHub repo (https://github.com/steelhawks/HawkeyeCV/tree/master/src), mostly gathered across the Internet (the repo's not very well documented - sorry).

You may find it easier to begin with OpenCV-Python or SimpleCV, which have great documentation (http://docs.opencv.org/trunk/doc/py_tutorials/py_tutorials.html). Here's a StackOverflow post (http://stackoverflow.com/questions/10677317/books-for-opencv-and-python) with a bunch of other good resources.