facial recognition OpenCV
in
Contributed Library Questions
•
1 year ago
Hello all!
I am trying to make this code, which identifies faces right now, identify features as well: eyes, mouth, nose. How
can I modify this code to do that? I'm also interested in identification, or creating profiles so that one face is known from another i.e. this is Peter, that is Susan. I hope to also get the names to hover above the faces. Any help would be greatly appreciated!!!
All the best
- import hypermedia.video.*;
- import java.awt.Rectangle;
- import processing.serial.*;
- int gx = 15;
- int gy = 35;
- int spos=90;
- Serial port;
- OpenCV opencv;
- // contrast/brightness values
- int contrast_value = 0;
- int brightness_value = 0;
- void setup() {
- size( 640, 480 );
- 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"
- }
- public void stop() {
- opencv.stop();
- super.stop();
- }
- void draw() {
- // grab a new frame
- // and convert to gray
- opencv.read();
- opencv.convert( RGB );
- 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<faces.length; i++ ) {
- rect( faces[i].x, faces[i].y, faces[i].width, faces[i].height );
- }
- }
1