Need help loading Axis Camera feed in Java

So I’m trying to do a little vision project and I’m stuck at how to import the live camera feed into java run on eclipse Kepler. I have OpenCV and, wpilib installed correctly. I can’t get the Axis Camera “location” to work, (note I’m not using wpilib workspace at all, I made a project folder with openCV)

I have the Camera’s IP set to and it works on a web browser,
However I don’t know how to initialize the camera correctly in java
Any help would be welcomed.

We have some Java code available on github that provides some examples of opening a video feed using the OpenCV methods.

The project can be found at:

In particular the class (

  • The open(String url, int devId, int width, int height) method demonstrates the OpenCV methods we use to connect to the video capture device.
  • The run() method within the CaptureThread class (also in demonstrates opening and reading in frames.

We did find that determining the correct URL for cameras was a bit tricky. For the Axis M1103 at IP, we ended up using:

This seemed to have lower latency than using the H264 encoding available at:


Finally, setting up your OpenCV environment can be tricky. If the necessary libraries aren’t found, you can easily find yourself in a situation where you can grab still images just fine from the camera just fine, but are unable to grab a live stream.

Hope that helps.