ofxFlowTools use external cam

Slowly learning my way around OpenFrameworks.
& trying to do some responsive visuals using a camera and Moostriks Addon ofxFlowTools —

https://github.com/moostrik/ofxFlowTools/tree/master/example

Come across one problem —
How can i adapt the FlowTools example so that it detects an external usb camera rather than the built in mbp camera?
Would I need to include another Addon? If so which one works best?

Thanks
JB

Hi JB,

As long as you have any necessary drivers installed for the USB camera you shouldn’t need an extra addon.

print out all the detected devices:

ofLog() << myVideoGrabber.listDevices()

See if your camera is listed. (If it isn’t you probably have a driver issue. )

Set your device to be that of the usb camera:

myVideoGrabber.setDeviceId(3);

XO,
CR

Thanks Caroline,
I have given this a try, I inserted the code under - void ofApp::setup(){
But I am still stuck with this, something about undeclared identifiers…
It may sound such a novice problem but I don’t know where to insert these lines of code, do you mind providing a further pointer?

Putting it in setup is the right start. It might be helpful to look at the videoGrabber example! It is located in examples/video/videoGrabberExample . This example demonstrates the use of listDevice() and setDeviceId(). If your usb camera is connected with all the drivers and you run this example you should see it print something like the following to your console:

[notice ] 0: FaceTime HD Camera
[notice ] 1: myUSB cam

Then you’ll know that your device ID is 1 and you can set this next time you run the code:

vidGrabber.setDeviceID(1);

haha… I really must check the examples more often.
So very helpful, thank you! That’s all I need :wink: