Hey guys! I’m a newbie in processing and am trying to do a project based on some tutorials on youtube about “rasterizing” and image. After doing that i wanted to change form image to video. The problem I’m having is that my camera(USB connected camera) seems to not work with the program. Also I tried the same exact code with a built-in camera on a laptop and it kind of worked(all i god is a black screen but at least the camera turned on) Is this a software problem or a hardware one as i know my camera is not really that great.
Also the final goal for the project is to control the tile number, making up the picture, by mapping the brightness levels of the camera (ie getting closer or further away from the camera)
Sorry for the long post, here is my code:
import processing.video.*;
Capture video;
//PImage img;
float scaleVar = 1;
void setup() {
size(600, 600, P3D);
//println(Capture.list() );
video = new Capture(this,0 ,0,15);
video.start();
printArray(Capture.list());
//img = loadImage(“2.jpg”);
//img = loadImage(“BEATH.jpg”);
//img.resize(600, 0);
}
void captureEvent(Capture video){
video.read();
}
void draw(){
background(#f1f1f1);
translate(width/2, height/2);
scaleVar = map(mouseY, 0, width, 0.1, 5);
scale(scaleVar);
fill(0);
noStroke();
sphereDetail(3);
float tiles = 100;
float tileSize = width/tiles;
push();
//translate(width/2, height/2);
//rotateY(radians(frameCount/2));
//rotateX(radians(frameCount/2));
for (int x = 0; x < tiles; x++) {
for (int y = 0; y < tiles; y++) {
color c = video.get(int(x*tileSize), int (y*tileSize));
float b = map(brightness(c), 0,255,1,0);
float z = map(b,0,1, 70,-70);
push();
translate(x*tileSize - width/2, y*tileSize - height/2, z);
sphere(tileSize*b*0.7);
pop();
}
}
pop();
}