J'ai de nouveaux dossiers contenant des images qui sont créées dans le dossier de données de ma croquis chaque fois que je cours une esquisse différente. Je dois trouver un moyen de charger dans les images les plus récentes dans le dossier le plus récent créé. Il ressemble à ceci: http://imgur.com/a/0PIsJ (test2 étant le plus récent créé)
Comment est-ce que je ferais cela en utilisant Pimage?Comment puis-je charger le dossier le plus récent créé avec Pimage?
Le code J'utilise actuellement dans mon sketch:
final int len=25;
final float thresh=170;
final int STEPX=18;
final int STEPY=18;
boolean newDesign=false;
PImage pic;
ArrayList<PImage> imgContainer;
int n=3;
void setup() {
size(800, 800, P2D);
colorMode(RGB, 255);
rectMode(CENTER);
//imageMode(CENTER);
pic=loadImage("hand.jpg");
pic.resize(width, height);
color c1 = color(200, 25, 25);
color c2 = color(25, 255, 200);
imgContainer=new ArrayList<PImage>();
for (int i=0; i<n; i++) {
PImage pimg=loadImage("");
pimg.resize(STEPX,STEPY);
imgContainer.add(pimg);
}
noLoop(); //Driven by redraw
noStroke();
}
void draw() {
background(250, 250, 250);
if (newDesign==false) {
return;
}
pic.loadPixels();
for (int y = 0; y < height; y+=STEPY) {
for (int x = 0; x < width; x+=STEPX) {
// Get the color stored in the pixel
int index=y*width+x;
color pixelValue = pic.pixels[index];
// Determine the brightness of the pixel
float pixelBrightness = brightness(pixelValue);
float imgPicked=map(pixelBrightness,0,255, 0, n);
println("DEBUGGING check n="+n+" map returns "+imgPicked);
image(imgContainer.get((int)imgPicked), x, y);
}
}
}
void mouseReleased() {
newDesign=!newDesign;
redraw();
}
Avez-vous déjà compris cela? –
Ouais je l'ai fait, mais j'ai abandonné le projet alors j'oublie comment je l'ai fait: \ – daddydean