Skip to content

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

Open

Description

@lmagoncalo

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.

Activity

  1. transferred this issue frombenfry/processing4on Jul 20, 2022
  2. ffd8 commented on Sep 4, 2022

    @ffd8

    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?

  3. added this to the Version 2.2.2 milestone on Sep 5, 2022
  4. ajavamind commented on Sep 20, 2022

    @ajavamind

    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);
    }

  5. removed this from the Version 2.2.2 milestone on Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions