Cours3 1. Interagir avec les pixels d'une image (3D) - picardlimpens/TechArtsNum GitHub Wiki
PImage img;
int dimCellule = 4;
void setup() {
smooth();
img = loadImage("monImage.jpg");
size(img.width+100,img.height+100,P3D);
}
void draw() {
background(0);
noStroke();
for(int i=0; i<=((img.width)-dimCellule); i+=dimCellule) {
for (int j=0; j<=((img.height)-dimCellule); j+=dimCellule){
color pix = img.get(i, j);
float z = (mouseY / float(width)) * (brightness(pix))*2 ;
pushMatrix();
translate(i+width/2-img.width/2, j +height/2-img.height/2, z);
fill(pix, 204);
noStroke();
ellipse(0, 0, dimCellule, dimCellule);
popMatrix();
}
}
if(mousePressed) {
save("ImageEn3DSimple.png");
}
}