import processing.opengl.*; // face stuff import hypermedia.video.*; import java.awt.Rectangle; OpenCV opencv; void setup() { size (600, 400, OPENGL); noStroke(); // Face stuff opencv = new OpenCV( this ); opencv.capture(width,height); opencv.cascade(OpenCV.CASCADE_FRONTALFACE_DEFAULT); smooth(); ellipseMode(CORNER); } void draw() { float camZ = (height/2.0) / tan(PI*60.0/ 360.0); camera(mouseX, mouseY, camZ, width/2.0, height/2.0, 0, 0,1,0); // Face stuff opencv.read(); Rectangle[] faces = opencv.detect(); //filll(0xFF, 0X00, 0X84, 0X3F); // noStroke(); for ( int thisFace = 0; thisFace < faces.length; thisFace++) { ellipse (faces[thisFace].x, faces[thisFace].y, faces[thisFace].width, faces[thisFace].height); //shape (s,faces[thisFace].x, faces[thisFace].y, faces[thisFace].width, faces[thisFace].height); // Change height of the camera with mouseY camera(faces[thisFace].x, faces[thisFace].y, camZ *-1, width/2.0, height/2.0, 0, 0,1,0); } //box // Orange point light on the right ambientLight(100, 150, 109); // Color pointLight(150, 100, 0, // Color 200, -150, 0); // Position // Blue directional light from the left directionalLight(0, 102, 255, // Color 1, 0, 0); // The x-, y-, z-axis direction // Yellow spotlight from the front spotLight(255, 255, 109, // Color 0, 40, 200, // Position 0, -0.5, -0.5, // Direction PI / 2, 2); // Angle, concentration background (0); translate(width/2.0, height/2.0, -20); int dim = 100; box(dim, dim, dim); }