processing / processing4-javafx

JavaFX library for Processing 4
14 stars 5 forks source link

Capture not working with FX2D #7

Open brendanmatkin opened 8 years ago

brendanmatkin commented 8 years ago

Processing 3.0.2. OS X 10.11.3.

Can't seem to get capture to access a camera when using the FX2D renderer. Movie() works, Capture() does not. Capture works fine with default renderer, P2D, P3D (actually runs fastest with P3D).

Can reproduce this by loading the example sketch "GettingStartedCapture" and adding in the FX2D renderer.

Thought it might just be a problem with Capture.list(), but if I do Capture(this, 1280, 720, 30), camera seems to load, but cam.available() always returns false.

Thanks!

EDIT: This seems to be working in some sketches, not in others. I have yet to determine what is causing the problem. Can anyone else replicate this issue? I might be doing something dumb!

ALSO: In the sketch that FX2D is working, I can display each from with either set(0, 0, cam) or image(cam, 0, 0), but P2D/P3D only work with image(cam, 0, 0).

brendanmatkin commented 8 years ago

Ok That comment is a mess. I think there are two things not working with FX2D:

  1. anything to do with Capture.list(). It just hangs on that method forever.
  2. Capture.available() always returns false in SETUP. In DRAW it works normally (I need it to be available to instantiate an instance of opencv).

Can't replicate the P2D/3D image/set issue in a fresh sketch so it's probably nothing.

cbsrobot commented 8 years ago

I tried Processing 3.0.2 on OS X 10.8.5 (I know, I know) and had 2 Logitech C920 attached. After a cold boot Capture.list() hangs forever. After unplugging and replugging both cameras the Capture.list() shows all possible device modes.

The workaround is to list the devices (after unplugging and replugging the cameras) and hardcoding the Result to:

cam = new Capture(this, "camera_name,resolution_and_fps");

brendanmatkin commented 8 years ago

Yeah, it's easy enough to get around the Capture.list() (can also just do new Capture(this, width, height, FR)). Just inconvenient, really. Good to know about unplugging it (although this is impossible with the built-in cam).

Were you able to replicate the Capture.available part?

cbsrobot commented 8 years ago

Not sure Capture(this, width, height, fps) will work with two similar cameras, but I had the Capture.available in the draw() loop anyways, so I did not test that. While hunting down the bug, I tried to change the sketch to P2D/P3D but it gave me some strange errors and I left it to the default FX2D.

The cameras are installed and I cannot test it atm - sorry.