He Philho,
It's me the student with his slideshow and taking pictures program again :) haha yeah Again!!
I looked at renameTo and it's also allready in the script. But a few things I can't do are things like.
- Counting number of files in a folder
- Moving them all at one time.
- Or move the oldest picture by date.
Can you or someone help me with that.
- import hypermedia.video.*;
import java.awt.Rectangle;
OpenCV opencv;
boolean pictureJustTaken = false;
int startTimer;
int interval = 5; // interval in seconds
String path = "/Users/menno/Documents/Processing/picture_pool/";
void setup() {
size(320,240);
opencv = new OpenCV(this);
opencv.capture(width,height);
opencv.cascade(OpenCV.CASCADE_FRONTALFACE_ALT);
}
void draw() {
opencv.read();
image(opencv.image(),0,0);
Rectangle[] faces = opencv.detect(1.2,2,OpenCV.HAAR_DO_CANNY_PRUNING,40,40);
if (pictureJustTaken == false && faces.length >= 1) {
String fileName = "faces" + year() + "-" + month() + "-" + day() + " " + hour() + "." + minute() + "." + second() + ".jpg";
File ff = new File(path + "_" + fileName);
save(ff.getAbsolutePath()); // Long operation
// Rename on the fly
ff.renameTo(new File(path + fileName));
pictureJustTaken = true;
startTimer = millis();
println(frame);
}
if (pictureJustTaken) {
if (millis() - startTimer > (interval * 1000)) {pictureJustTaken = false;}
}
}
public void stop() {
opencv.stop();
super.stop();
}