Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get on video Capture using P2D/P3D/OPENGL renderer #203

Open
lmagoncalo opened this issue Jul 19, 2022 · 2 comments
Open

Get on video Capture using P2D/P3D/OPENGL renderer #203

lmagoncalo opened this issue Jul 19, 2022 · 2 comments
Labels

Comments

@lmagoncalo
Copy link

lmagoncalo commented Jul 19, 2022

When using the function get() in a video capture, the returned PImage is all black when using the P2D/P3D/OPENGL renderer. However, if I switch the renderer to JAVA2D it works fine.

Code to reproduce:

import processing.video.*;

Capture cam;
PImage img;

void setup() {
  size(640, 480, P2D); // Change to JAVA2D to work

  String[] cameras = Capture.list();
 
  cam = new Capture(this, cameras[1]);
  cam.start();        
}

void draw() {
  if (cam.available() == true) {
    cam.read();
    img = cam.get();
  }
  image(img, 0, 0);
}

I am using the macOS Monterey but it also happens using a Windows 10.

@benfry benfry transferred this issue from benfry/processing4 Jul 20, 2022
@ffd8
Copy link

ffd8 commented Sep 4, 2022

Not sure if it's related, but I could only get the camera to work (using P3D mode) when displaying the video image one, ie image(cam, 0, 0);.. I only wanted the pixel brightness, so it worked to place it once within the setup... but made me check issues as to why this was needed and might be connected to your issue?

@ajavamind
Copy link

ajavamind commented Sep 20, 2022

This issue also occurs with Windows 11 Pro.
And cam.copy() has the same problem.
I also used the Video library TimeDisplacement example, changing to size(640, 480, P2D) to verify the issue exists.

Also this code shows video but the camera image cannot be modified:

import processing.video.*;

Capture cam;
PImage img;

void setup() {
size(640, 480, P2D); // Change to JAVA2D to work

String[] cameras = Capture.list();

cam = new Capture(this, cameras[1]);
cam.start();
}

void draw() {
if (cam.available() == true) {
cam.read();
img = cam;
//img = cam.get();
}
image(img, 0, 0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants