y el codigo para Processing
import processing.opengl.*;
import hypermedia.video.*;
OpenCV opencv;
int ancho_sketch = 800; //
int alto_sketch = 600; //
//-----------------------//
int ancho_captura = 320;
int alto_captura = 240;
PImage cara;
void setup() {
size(ancho_sketch,alto_sketch,OPENGL);
opencv = new OpenCV(this);
opencv.capture( ancho_captura , alto_captura );
opencv.cascade(OpenCV.CASCADE_FRONTALFACE_ALT);
cara = createImage(80, 60, RGB);
}
void draw() {
background(0);
Rectangle[] faces = opencv.detect();
opencv.read();
//image( opencv.image(),0,0);
//saveFrame(”cam####.png”);
//background(0);
for( int i=0; i
int x = faces[i].x;
int y = faces[i].y;
int w = faces[i].width;
int h = faces[i].height;
//cara.copy(opencv.image(),x,y,w,h,0,0,cara.width,cara.height);
x = (x*100)/ancho_captura;
x = (width*x)/100;
y = (y*100)/alto_captura;
y = (height*y)/100;
w = (w*100)/ancho_captura;
w = (width*w)/100;
h = (h*100)/alto_captura;
h = (height*h)/100;
float dw=120.0/w;
float cx=(x+w/2.0);
float cy=(y+h/2.0);
translate(width/2,height/2,0);
scale(dw,dw,dw);
translate(-cx,-cy,0);
image( opencv.image(), 0, 0,width,height );
//saveFrame("fx####.png");
}
}
Fuente: Stream.i2offPlusR3nder