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; String user = "james"; String pass = "password"; String database = "test"; String table = "video_list"; int x_pos = 0; int y_pos = 0; MySQL msql; 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" 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))"); } else{ println("connection failed!"); } } public void stop() { opencv.stop(); super.stop(); } void draw() { // 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 ); // draw face area(s) noFill(); stroke(255,0,0); for( int i=0; i