Webcam replacing with ip-camera

Hello.
I’m working on a color tracking project that enables me sending the x, y coordinates of the tracked object using OSC to SuperCollider. This works pretty well.

Now I’d like to replace my webcam with a ip-camera. I use a Foscam F19918W and so far I can access the camera very easy using a browser: http://192.168.1.33/videostream.cgi?user=admin&pwd=""[P]
or a terminal: vlc http://192.168.1.33/videostream.cgi?user=admin&pwd=1234&resolution=64&rate=0

I tried succesless the library ofxIpVideoGrabber and ofxIpCamera. I’m a newbie to OF and fiddling around with both libraries I couldn’t access my Ip-Camera.

Thanks Martin

ofxIpVideoGrabber is done using gstreamer, if you are on linux it should just work in osx you can try with this addon:

http://github.com/arturoc/ofxGStreamer

follow the instructions in the readme, since you’ll need the latest version of the project generator, the one in OF 0.8.0 won’t work

I use Linux.
Before I implement the code to the project I would like to connect to my ip-camera.
So, there I’m already struggling.
I’m working with CodeBlocks and I don’t know how to setup a project with the included files in the ofxIpVideoGrabbers example folder. What I did, until now, is I setting up a new project using the projectGenerator and place it into the ofxIpVideoGrabber folder.
The example of the ofxIpVideoGrabber library includes files named main.cpp, ofApp.cpp and ofApp.h.
Do I add this files simply to the src folder and replace the main.cpp with the one of the example folder?
Until now all my trials fail.
Thanks Martin

you just need to add the addon in the project generator before generating the project

Uff, simpler then I thought.

But still I only get an empty window:

bUseProxy_a = false;
proxyUsername_a = “admin”;
proxyPassword_a = “1234”;
proxyHost_a = “192.168.1.33”;
proxyPort_a = Poco::Net::HTTPSession::HTTP_PORT;

The above configuration I put into the IpVideoGrabber.cpp. I don’t get any error nor an image.

I’m can access the camera with a browser or terminal via vcl

Thanks Martin

oh sorry i thought that was one of my addons :slight_smile:

i’ve just uploaded an addon i’ve used for accessing axis cameras before:

https://github.com/arturoc/ofxAxisGrabber

to use it create a normal ofVideoGrabber but instead of calling initGrabber, in sertup:

  
  
ofPtr<ofxAxisGrabber> axisGrabber(new ofxAxisGrabber);  
axisGrabber->setAuth(user,pass);  
axisGrabber->setCameraAddress(ip)  
grabber.setGrabber(axisGrabber);  
  

where grabber is an ofVideoGrabber that you use the usual way by calling update, draw, getPixelsRef…

The compiler stops at:

#include “ofxHttpUtils.h”

I suppose I have to add ofxAxisGrabber and ofxIpVideoGrabber to the project.
Thanks Martin

Next step:
I downloaded the “ofxHttpUtils” addon and now the complier holds at #include “ofxGui.h”.
I changed the “ofxGui.h” to “ofxAxisGui.h” and now the complier stops at line 26 of the " ofxAxisGui.h"

(…/…/…/addons/ofxAxisGrabber/src/ofxAxisGui.h|26|error: ‘ofxButton’ does not name a type.
Thanks Martin

you need to include ofxGui too. i’ve uploaded a example

I try to run the uploaded example but the compiler stops here:

grabber.iniVtGrabber(640,480); // ofApp.cpp

If I run make in a terminal I get:
src/ofApp.cpp:8:10: error: ‘class ofVideoGrabber’ has no member named ‘iniVtGrabber

Martin

i don’t see that call in the example:

https://github.com/arturoc/ofxAxisGrabber/blob/master/example/src/ofApp.cpp

i guess it’s initGrabber?

strange in my ofApp.cpp from your examble I have grabber.iniVtGrabber(640,480);

Changing it to initGrabber passes that, but now I stick at:

ofxButton autofocus; // ofxAxisGui.h

error:
…/…/…/addons/ofxAxisGrabber/src/ofxAxisGui.h:26:2: error: ‘ofxButton’ does not name a type

Thanks for your passion
Martin

you need to include ofxGui in the example. that addon is included in the project, are you using the latest version of openFrameworks? ofxGui only exists since 0.8.0

I have of_v0.8.0_linux64_release intslled.

My addons.make file has three entrances:
ofxAxisGrabber
ofxHttpUtils
ofxGui

If I open your project with CodeBlocks the included addons are not visible. But this is also when I open an other addon example. If I create a new project with the ProjectGenerator the addons are visible.

Is my setup ok?

“ofGstVideoUtils not loaded”

Still no luck.
To connect to the camera I configured the setup function of your example in the ofApp.cpp like this:

void ofApp::setup(){

ofPtr axisGrabber(new ofxAxisGrabber);
axisGrabber->setAuth(“admin”,“1234”);
axisGrabber->setCameraAddress(“192.168.1.33”);
grabber.setGrabber(axisGrabber);
grabber.initGrabber(640,480);

}

But I only get an empty windows and in the terminal I get a warning “ofGstVideoUtils not loaded”

Thanks Martin

Hi!

I’m writing an application that reads a lot of IP Cameras (not AXIS, but Arecont, with mjpeg stream). The app is based on ofxIPVideoGrabber and compiled in OSX.

It runs fine but sometimes randomly hangs because something related to threads. I suppose that other people has he same problem. How could I to solve it? Another library?

I’ve tried also with ofxWatchDog but doesn’t work with ofxPVideoGrabber.

Is it possible to access camera with h.264?

Thanks!

Guillermo

Thanks!

I created a new thread related to this topic, I’m using OpenCV to read from cameras. If you have openCV set up it could work for your needs.

http://forum.openframeworks.cc/t/how-i-grab-from-ip-cameras/13509/0

Hi, I’m waking up this thread.

Is the ofxAxisGrabber.h up-to-date for the dev branch of OF ?
I’m having some experiments about ipCameras…

I got all those compilations problems when compiling the example :

/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.h:27:19: Virtual function 'getPixels' has a different return type ('unsigned char *') than the function it overrides (which has return type 'ofPixels_<unsigned char> &')

/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:114:44: Cannot initialize a parameter of type 'ofPixelFormat' with an rvalue of type 'int'

/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:341:13: No member named 'getPixelsRef' in 'ofGstVideoUtils'; did you mean 'getPixels'?

Full log below :

clang: warning: -lpthread: 'linker' input unused
In file included from /Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:8:
../../../addons/ofxAxisGrabber/src/ofxAxisGrabber.h:27:19: error: virtual function 'getPixels' has a different return type ('unsigned char *') than the function it overrides (which has return type 'ofPixels_<unsigned char> &')
        unsigned char   * getPixels();
                          ^
In file included from /Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:8:
In file included from ../../../addons/ofxAxisGrabber/src/ofxAxisGrabber.h:11:
../../../libs/openFrameworks/types/ofBaseTypes.h:120:25: note: overridden virtual function is here
        virtual ofPixels_<T> & getPixels()=0;
                               ^
/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:114:44: error: cannot initialize a parameter of type 'ofPixelFormat' with an rvalue of type 'int'
        bool ret = gst.setPipeline(pipeline.str(),24,true,w,h);
                                                  ^~
In file included from /Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:8:
In file included from ../../../addons/ofxAxisGrabber/src/ofxAxisGrabber.h:15:
../../../libs/openFrameworks/video/ofGstUtils.h:150:53: note: passing argument to parameter 'pixelFormat' here
        bool                    setPipeline(string pipeline, ofPixelFormat pixelFormat=OF_PIXELS_RGB, bool isStream=false, int w=-1, int h=-1);
                                                                           ^
/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:337:9: warning: 'operator unsigned char *' is deprecated [-Wdeprecated-declarations]
        return gst.getPixels();
               ^
In file included from /Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:8:
In file included from ../../../addons/ofxAxisGrabber/src/ofxAxisGrabber.h:11:
In file included from ../../../libs/openFrameworks/types/ofBaseTypes.h:7:
In file included from ../../../libs/openFrameworks/3d/ofMesh.h:12:
In file included from ../../../libs/openFrameworks/gl/ofGLUtils.h:13:
../../../libs/openFrameworks/graphics/ofPixels.h:74:154: note: 'operator unsigned char *' has been explicitly marked deprecated here
        OF_DEPRECATED_MSG("Accessing pixels as unsigned char*, instead use ofPixels or getPixels().getPixels() if you are really trying to access the raw data",operator PixelType*());
                                                                                                                                                                ^
In file included from /Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:8:
In file included from ../../../addons/ofxAxisGrabber/src/ofxAxisGrabber.h:11:
In file included from ../../../libs/openFrameworks/types/ofBaseTypes.h:2:
../../../libs/openFrameworks/utils/ofConstants.h:40:50: note: expanded from macro 'OF_DEPRECATED_MSG'
        #define OF_DEPRECATED_MSG(message, func) func __attribute__ ((deprecated))
                                                 ^
/Users/dudleysmith/Dude_s_Place/_OF/openFrameworks/addons/ofxAxisGrabber/src/ofxAxisGrabber.cpp:341:13: error: no member named 'getPixelsRef' in 'ofGstVideoUtils'; did you mean 'getPixels'?
        return gst.getPixelsRef();
                   ^~~~~~~~~~~~
                   getPixels
1 warning and 3 errors generated.

no, we are changing the api a bit for 0.9 and among other things any class that implements ofBaseVideo will stop working. the changes are pretty simple, things like adding const to some methods or parameters or renaming getPixelsRef to getPixels, getTextureReference to getTexture…

anyway ofxAxisGrabber is not adapted yet to the new api

Ok, thanks for reply.
I will have a try in 0.8.4 version.

  • edit : it looks better in 0.8.4, but i got this :

ld: file not found: /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstapp-1.0.0.dylib for architecture i386

indeed, inside the framework, there a zero missing in the name…