Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

Face recognition - to visualise hidden background

$
0
0

Hi everyone,

Thank you for looking at my post and hope you can help me. I have a university project and I need to have a hidden background image, and then using face recognition to reveal this image (depending on the location of your face). Here is where I've got so far.

Can't seem to make the background disappear. Thank you in advance

import processing.video.*;
import gab.opencv.*;
import java.awt.*;

PImage photo;
int pixelcount;
color pixelcolor;

Capture firstcam;
OpenCV opencv;

void setup() {
  fullScreen();

  firstcam=new Capture(this, 1600, 900);
  opencv=new OpenCV(this, 1600, 900);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  firstcam.start();
  frameRate(24);
  noFill();

  colorMode(HSB, 360, 100, 100);
  strokeWeight(1);
  smooth();
  photo = loadImage("photo.jpg");
}

void draw() {
  opencv.loadImage(firstcam);
  Rectangle[] faces = opencv.detect();
  image(photo, 0, 0, 1600, 900);
  pushMatrix();
  translate(width, 0);
  scale(-1, 1);

  for (int i = 0 ; i < faces.length ; i++) {
    ellipse(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
    stroke(255,0,0);
    lights();
    smooth();
    strokeWeight(1.5);
  }

  popMatrix();
}

void captureEvent(Capture c) {
  c.read();
}

Viewing all articles
Browse latest Browse all 530

Trending Articles