We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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();
}
Answers
@erkosone hmmmm thanks for that though i guess what im looking for is a way to account for the Z axis and so i thought that if i use my original logic that will suffice for z
-Graciaz
@erkosone how do we find the
height and width
of this function?i think i tried just about every combination known in this formula to try to merge just like we did with faces but nothing is giving me or letting me combine other variables to make up the
height and width
i would like to accomplished the same thing we done with faces
this is what i last just tried so ill share with you guy although it did not work for me "just to show that i really am trying to learn and explore"