import hypermedia.video.*; import java.awt.Rectangle; import de.bezier.data.sql.*; OpenCV opencv; // contrast/brightness values int contrast_value = 0; int brightness_value = 0; int MAX = 10; int[] x = new int[MAX]; int[] y = new int[MAX]; int[] w = new int[MAX]; int[] h = new int[MAX]; int[][] Faces = new int[MAX][3]; //int[] img = new int[320*240]; PImage img; MySQL msql; String user = "bob"; String pass = "password"; String database = "test"; String table = "faces"; int x_pos = 0; int y_pos = 0; int w_face = 0; int h_face = 0; void setup() { size(320,240); opencv = new OpenCV( this ); opencv.capture( width, height ); // open video stream opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); // load detection description, here-> front face detection : "haarcascade_frontalface_alt.xml" // print usage println( "Drag mouse on X-axis inside this sketch window to change contrast" ); println( "Drag mouse on Y-axis inside this sketch window to change brightness" ); strokeWeight(2); stroke(255,200,0); noFill(); msql = new MySQL( this, "localhost", database, user, pass ); if (msql.connect()) { msql.execute( "CREATE TABLE IF NOT EXISTS " + table + " ("+"id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,filename VARCHAR( 100 ), x_coord VARCHAR(10), y_coord VARCHAR(10), width VARCHAR(10), height VARCHAR(10))"); } else { println("connection failed!"); } } void draw() { background(0); // grab a new frame // and convert to gray opencv.read(); opencv.convert( GRAY ); opencv.contrast( contrast_value ); opencv.brightness( brightness_value ); // proceed detection Rectangle[] faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 ); // display the image image( opencv.image(), 0, 0 ); img = opencv.image(); loadPixels(); //arraycopy(img,pixels); //updatePixels(); // draw face area(s) noFill(); stroke(255,0,0); int count = faces.length; if (count>0) { for( int i=0; i