I'm trying to program an interaction using opencv, in which
1) The script looks for faces in a video feed
2) When a face is found, it calculates the area of the face
3) If the area is larger than a set number, it starts a photobooth. Otherwise, start from (1)
4) When in photobooth mode, the screen flashes the "3" for one second, "2" for one second, "1" for one second, and then it captures the frame
5) After the frame is captured, the image is displayed on screen for as long as the person stands in front of the camera (as long as a face is still detected)
6) When a face is no longer detected, start over.
I'm having problems with (4) and (5)
This is the script I have so far. In place of 4, I have it display a word "hello" for 3 seconds, but what I'm getting is a blank screen for three seconds, then a captured image, then a blank screen for three seconds, etc.
import hypermedia.video.*;
import java.awt.Rectangle;
boolean doCapture = false; // determines whether to enter sequence
int prevMillis;
int count;
OpenCV opencv;
OpenCV photob;
PFont font;
PImage photo;
void setup() {
size(640,480);
// Font
font = loadFont("skyhook.vlw");
textFont(font, 200);
// OpenCV
opencv=new OpenCV(this); // when doCapture=false
opencv.capture(width,height,1);
opencv.cascade(OpenCV.CASCADE_FRONTALFACE_ALT); // load the FRONTALFACE description file
I'm new to processing, and trying to write code to do a simple slideshow. The slideshow is simply an image shown on a screen for a number of seconds, followed by the next, and looped from the beginning.
I've been looking into arrays and classes since I know that doing it via brute repetition is horribly inefficient, but the problem I have is that the number of images is not constant; it steadily increases over time as new images are added through a webcam capture.
I'm new to processing, and trying to write code for an installation that I will be doing.
Basically, I've been using face detection in OpenCV to find faces in a live webcam feed. What I want to do is to trigger an image capture only when the size and position of the face cross certain thresholds, say 25% of the area and near the center of the image.
The opencv base code (
http://ubaa.net/shared/processing/opencv/opencv_detect.html) draws a rectangle where a face is detected ... could I use the size/position of the rectangle to decide whether or not it triggers the capture? And how can I capture the frame without the rectangle in it?