Tuesday, October 26, 2010

Multiple Cameras in Processing

a quick note

method #1: using opencv
The index parameter in opencv.capture(w, h, index) is no implementation, no functionality at all.You can't use the index parameter to switch either camera, only the default one would be available.

method #2: using two Capture instances
Capture cam1, cam2;
cam1 = new Capture(this, w, h, camera#1, fps);
cam2 = new Capture(this, w, h, camera#2, fps);
Passed compiler check, but one of the camera would be frozen.

method #3: dynamically new a Capture instance
Capture cam;
cam = new Capture(this, w, h, which_camera, fps);
This method would switch camera successfully at the first time, but fail while next try.


solved.
Using method 3 with a call to cam.dispose before new an instance. And cam.stop() does not work!
Because the QT instance only allow one instance among all applications.

No comments: