Webcam framerate choppy
in
Integration and Hardware
•
5 months ago
Hello all,
I'm working on a robot that drives a USB camera around on a physical gantry. My system is OSX 10.7.5, and I'm running Processing 2.0b8. I've got everything working except for the video image, which is supposed to show up as a live feed in the Processing window when the sketch is run. When I plug the camera in, Photobooth recognizes it automatically at full resolution and full frame rate. However, when I try the boilerplate Capture() code on the Processing site, I get a very long list of possible cameras. These include many versions of the same device, and often cause the process to stall and error out:
So! I feel like I'm close, but I need some guidance about how to pick a specific camera (with resolution and framerate) off my available cam list. When I just select the list number with
Thanks for reading.
I'm working on a robot that drives a USB camera around on a physical gantry. My system is OSX 10.7.5, and I'm running Processing 2.0b8. I've got everything working except for the video image, which is supposed to show up as a live feed in the Processing window when the sketch is run. When I plug the camera in, Photobooth recognizes it automatically at full resolution and full frame rate. However, when I try the boilerplate Capture() code on the Processing site, I get a very long list of possible cameras. These include many versions of the same device, and often cause the process to stall and error out:
... and when it does work, here's the list:Exception in thread "Animation Thread" java.lang.RuntimeException: Waited 5000ms for: <1a99836, 148083b>[count 2, qsz 0, owner <AWT-EventQueue-0>] - <Animation Thread>
Now, after reading many post on this forum, I've arrived at the following:vailable cameras:
name=PC Cam,size=1600x1200,fps=30
name=PC Cam,size=1600x1200,fps=15
name=PC Cam,size=1600x1200,fps=1
name=PC Cam,size=800x600,fps=30
name=PC Cam,size=800x600,fps=15
name=PC Cam,size=800x600,fps=1
name=PC Cam,size=400x300,fps=30
name=PC Cam,size=400x300,fps=15
name=PC Cam,size=400x300,fps=1
name=PC Cam,size=200x150,fps=30
name=PC Cam,size=200x150,fps=15
name=PC Cam,size=200x150,fps=1
name=PC Cam,size=100x75,fps=30
name=PC Cam,size=100x75,fps=15
name=PC Cam,size=100x75,fps=1
name=FaceTime HD Camera (Built-in),size=1280x720,fps=30
name=FaceTime HD Camera (Built-in),size=1280x720,fps=15
name=FaceTime HD Camera (Built-in),size=1280x720,fps=1
name=FaceTime HD Camera (Built-in),size=640x360,fps=30
name=FaceTime HD Camera (Built-in),size=640x360,fps=15
name=FaceTime HD Camera (Built-in),size=640x360,fps=1
name=FaceTime HD Camera (Built-in),size=320x180,fps=30
name=FaceTime HD Camera (Built-in),size=320x180,fps=15
name=FaceTime HD Camera (Built-in),size=320x180,fps=1
name=FaceTime HD Camera (Built-in),size=160x90,fps=30
name=FaceTime HD Camera (Built-in),size=160x90,fps=15
name=FaceTime HD Camera (Built-in),size=160x90,fps=1
name=FaceTime HD Camera (Built-in),size=80x45,fps=30
name=FaceTime HD Camera (Built-in),size=80x45,fps=15
name=FaceTime HD Camera (Built-in),size=80x45,fps=1
- import processing.video.*;
- Capture cam;
- void setup() {
- size(800, 600, P2D);
- frameRate(30);
- String[] cameras = Capture.list();
- if (cameras.length == 0) {
- println("There are no cameras available for capture.");
- exit();
- } else {
- println("Available cameras:");
- for (int i = 0; i < cameras.length; i++) {
- println(cameras[i]);
- }
- cam = new Capture(this, "name=PC Cam");
- cam.start();
- }
- }
- void draw() {
- if (cam.available() == true) {
- cam.read();
- }
- image(cam, 0, 0);
- }
... but then it grabs a very low res image. On the bright side, this small image runs at the maximum frame rate.Resolution information not available, attempting to open the capture device at 320x240
So! I feel like I'm close, but I need some guidance about how to pick a specific camera (with resolution and framerate) off my available cam list. When I just select the list number with
- cam = new Capture(this, cameras[0]);
- cam = new Capture(this, "name=PC Cam,size=800x600,fps=30");
Thanks for reading.
1