sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.28k stars 1.11k forks source link

Mobotix Ip Cam #193

Open Koalk opened 10 years ago

Koalk commented 10 years ago

I'd like to have this cams added to the driver.

They have an extensive HTTP API and also an SDK. The http api is explained in this url and the SDK can be found in the Mobotix web page http://developer.mobotix.com/paks/help_cgi-remotecontrol.html

Also there is a public cam here http://80.122.26.250:7000/ that you can use as endpoint with guest permissions. I'm probably going to start trying to add it myself but since I don't have much knowledge in this topic is going to take a lot of time for me.

Thanks in advance.

PD: here you have a list of public address for cams of multiple types if you want to add more to the driver http://totalcontrolapp.com/index.php?option=com_content&task=view&id=55

Koalk commented 10 years ago

I have been woking on my own trying to do at least the image retrieve with a basic extension of the IpCamDevice overriding the constructor and the getURL. The cam has an auth alert that ask for the username and password when you try to reach the URL of the image retrieve but I though that setting the auth of the IpCam as "new IpCamAuth(username,password)" should be enought.

Anyway when I start a new WebCamPanel with the IpCamDevice as it is done in the examples, the JFrame shows the "Image not available" message and there are no error message in the log so I am clueless about what could I be missing.

Koalk commented 10 years ago

I have been doing some code in order to retrieve just the image from the cam.

By now I can only retrieve what the actual interface of mobotix is showing with a call to "http://(cam IP)/record/current.jpg".

I have been trying to use some other adresses from the http API like "http://(cam IP)/cgi-bin/faststream.jpg" in PUSH mode and "http://(cam IP)/cgi-bin/image.jpg" in PULL mode. The difference is that this calls accept extra options in order to change the size of the image and the format among others, but it was impossible to me to retrieve any image from there.

Also I am having some problems setting the resolution of the cam since it is throwing a null pointer exception when I try to do a getResolutions().

I will keep you posted with more information and here it is what I have been doing so far with the class. (let me know if you prefer a pull request or something like that to show you the code)

Do widzenia!

import java.net.MalformedURLException;
import java.net.URL;

import com.github.sarxos.webcam.WebcamException;
import com.github.sarxos.webcam.ds.ipcam.IpCamDevice;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;

public class MobotixCamIp extends IpCamDevice {

    private URL base;

    public MobotixCamIp(String name, String url) {
        this(name, toURL(url));
    }

    public MobotixCamIp(String name, URL base){
        super(name, null, IpCamMode.PULL);
        this.base = base;
    }

    public MobotixCamIp(String name, URL url, IpCamMode pull) {
        super(name,url,pull);
    }

    @Override
    public URL getURL() {
//      String url = String.format("%s%s",base,"cgi-bin/faststream.jpg?error=picture&preview&stream=full");
        String url = String.format("%s%s",base,"record/current.jpg");
//      if (this.getResolutions()!=null)
//          url.concat(String.format("&size", this.getResolution().height,this.getResolution().width));
        try {
            return new URL(url);
        } catch (MalformedURLException e) {
            throw new WebcamException(String.format("Incorrect URL %s", url), e);
        }
    }   
}
nurvasi commented 9 years ago

Hi! I need have a mobotix live view in a java program in pull mode (to get the best image rate). This library (sarxos) can do this with mobotix cam?? Can you help me?? Without this library, I try connect and reading from the DataInputStream, but only get ok the image in push mode (connect, read image, disconnect, connect, read image, disconnect...) with a bad rate (2fps), with the pull mode (connect, read, read, read...) I can´t get the images!!! I dont know the encapsulation mode (in axis I only have to discard first four lines and the last one, but no run with mobotix cams...)

Thanks in advance.