hello there i have this sketch that tells me if they are faces on the screen and depending on how close or far you are to the cam then the rectangle would change its size, my question is how can i tell if the box is getting bigger or smaller WITHOUT ME actually being able to look at the screen?
what i really want to do is write to the port a string that on the other side i can have a midi sd card read wav/midi files pertaining to the size of the rectangle
import gab.opencv.*;
import processing.video.*;
import java.awt.*;
import processing.serial.*;
Capture video;
OpenCV opencv;
Serial port;
void setup() {
size(640, 480);
port = new Serial(this, Serial.list()[0], 19200);
video = new Capture(this, 640/2, 480/2, "360HD Hologen");
opencv = new OpenCV(this, 640/2, 480/2);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
video.start();
}
void draw() {
scale(2);
opencv.loadImage(video);
image(video, 0, 0 );
noFill();
stroke(0, 255, 0);
strokeWeight(1);
Rectangle[] faces = opencv.detect();
println(faces.length);
for (int i = 0; i < faces.length; i++) {
rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
}
}
void captureEvent(Capture c) {
c.read();
}