Face detection interaction [closed]
Hello,
Basically, I want to do a program where you have an image (or video, whatever) that we'll call "image A". When a face is close enough to the camera and recognized, image A slowly morph into image B. To do that, I think I need a code that tells the face detector that the face needs to be, say, 3 feet (1meter) maximum from the camera and that the morphing needs to be really smooth. That's my two most important issues… I am new to Processing so that's why I really need your help please !
Thank you so much
Edit : Here is my code so far, I'm sorry it's so messy… and my images are scaled up so they're bigger on my screen i don't know why but this is not the most important problem i think (?).
import gab.opencv.*;
import processing.video.*;
import java.awt.Rectangle;
PImage image;
PImage flou;
PImage nette;
Capture cam;
OpenCV opencv;
Rectangle[] faces;
void setup() {
fullScreen();
background (0, 0, 0);
cam = new Capture( this, 640, 480, 30);
cam.start();
opencv = new OpenCV(this, cam.width, cam.height);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
image=loadImage("image.jpg");
nette=loadImage("nette.jpg");
flou=loadImage("flou.jpg");
}
void draw() {
opencv.loadImage(cam);
faces = opencv.detect();
image(cam, 0, 0);
if (faces!=null) {
for (int i=0; i< faces.length; i++) {
image(nette,0,0);
noFill();
stroke(255, 255, 0);
strokeWeight(10);
rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
}
}
if (faces.length<=0) {
textAlign(CENTER);
fill(255, 0, 0);
textSize(56);
println("no faces");
image(flou,0,0);
text("UNDETECTED", 200, 100);
}
}
void captureEvent(Capture cam) {
cam.read();}
what have you tried so far ? is there any code, you can show ?
Processing -- if you mean the library, we cannot help you with that.
Hi, thank you for your quick answer ! I edited my post so you can have the code (without the data, i don't know how to import it but you can replace the images)
i'm sorry, but we cannot help you with unsupported, 3rdparty libs like processing (which is also using only a very small subset of very outdated opencv1.0 code. better stop using that, entirely)
Okay thank you anyways. have a good day
still, since faces don't come in arbitrary sizes, you're safe to assume, that a larger rectangle means a closer face. but this is only, where the real work would start, e.g. finding a mask from facial landmarks, delauny triangulation, seamless cloning. and again, i'm afraid, you won't be able to do anything like that from the very limited toolset, processing offers.