urgent - cam is white on save with OPENGL and more problems with 2.0
in
Core Library Questions
•
3 months ago
I'm working on a project for my graduation which has to be finished really soon.
I have some problems in processing 1.5.1. with libraries. So i made a switch to processing 2.01.
It wouldn't be processing if i had new problems. After a long time of digging i figured out it is the webcam in combination with OPENGL. It shows fine on the canvas. But when i save it's white.
Also when i acces the pixels there all 0.
updatePixels doesn't help.
can someone please help!!
- /**
- * Getting Started with Capture.
- *
- * Reading and displaying an image from an attached Capture device.
- */
- import processing.video.*;
- Capture cam;
- void setup() {
- size(640, 480, OPENGL);
- 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]);
- }
- // The camera can be initialized directly using an element
- // from the array returned by list():
- cam = new Capture(this, cameras[3]);
- // Or, the settings can be defined based on the text in the list
- //cam = new Capture(this, 640, 480, "Built-in iSight", 30);
- // Start capturing the images from the camera
- cam.start();
- }
- }
- void draw() {
- image(getImage(), 0, 0);
- }
- PImage getImage() {
- if (cam.available() == true) {
- cam.read();
- cam.updatePixels();
- cam.save("debug2/"+frameCount+".png");
- }
- return cam;
- }
1