face detection
in
Contributed Library Questions
•
2 years ago
Hi,
this is the first time I am usig the openCV library. I got the following piece of
code from the openCV website
while I was dissecting the code, I am not able to understand two things.
1) If I increase the size to(1024, 768) or (800, 600) the framerate drops instantly to
less than half. (I checked the camera capture at 1024*768 works fine without the
face recognition.)
2) Also the framerate drops, as soon as the faces are detected
(Rectangle[] faces = opencv.detect();) is executed.
Can someone please help me out with this issue.
Thanks in advance
import hypermedia.video.*;
import java.awt.Rectangle;
OpenCV opencv; void setup() {
size( 320, 240 );
opencv = new OpenCV(this);
opencv.capture( width, height );
opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT );
}
void draw() {
opencv.read();
image( opencv.image(), 0, 0 );
Rectangle[] faces = opencv.detect();
noFill();
stroke(255,0,0);
for( int i=0; i<faces.length; i++ ) {
rect( faces[i].x, faces[i].y, faces[i].width, faces[i].height );
}
}
1