processing-video icon indicating copy to clipboard operation
processing-video copied to clipboard

Webcam Capture Loads Blank Pixel Array in P2D/P3D

Open aidanlincolnn opened this issue 5 years ago • 2 comments

Description

When you create a canvas with P2D or P3D, the webcam capture does not contain any data (it is an array of black pixels).

Expected Behavior

The capture object pixel array should contain data

Current Behavior

The capture object pixel array contains all black

Steps to Reproduce

Run this program import processing.video.*; Capture video; PImage theImage;

void setup() { //this loads an array of black pixels size(640, 480, P3D); //this works as expected //size(640, 480); video = new Capture(this, 640, 480); video.start(); }

void draw(){ if (video.available()) video.read(); theImage = video.get(); theImage.loadPixels(); image(theImage,0,0); }

Your Environment

  • Processing version: 3.5.4
  • Operating System and OS version: OSX Catalina 10.15.4

aidanlincolnn avatar Apr 30 '20 20:04 aidanlincolnn

Not sure if the webcam has anything to do with it, cause this results in an array with only zero's as well:


PGraphics pg;

public void settings() {
    size(512, 512, P3D);
}

public void setup() {
    pg = create_some_graphics();
    pg.loadPixels();
}


public void draw() {
    background(0);
    image(pg, 0, 0);
}



PGraphics create_some_graphics() {
    PGraphics pg = createGraphics(512, 512, P3D);
    pg.beginDraw();
    pg.background(0);
    pg.pointLight(255, 0, 0, 0, height/2, 500);
    pg.pointLight(0, 0, 255, width, height/2, 500);
    pg.pointLight(0, 255, 0, width/2, 0, 500);
    pg.translate(width/2, height/2);
    pg.rotateY(0.01f * random(123));
    pg.rotateX(0.05f * random(456));
    pg.rotateZ(0.07f * random(789));
    pg.fill(255);
    pg.sphere(150);
    pg.box(500, 20, 20);
    pg.box(20, 500, 20);
    pg.box(20, 20, 500);
    pg.endDraw();
    return pg;
}

clankill3r avatar Aug 18 '20 09:08 clankill3r

This issue still remains, and no solution can be found.

lmagoncalo avatar Jul 19 '22 15:07 lmagoncalo