Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Face detection interaction

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

Face detection interaction

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();}