Prototype | Facial Recognition with filters

I have been working on the code that I was researching through the OpenCV library. The code that I was looking at was for a single face and I couldn’t quite figure out why I couldn’t apply a blur filter to the space in which the face was recognised in. With the code that I had, this is the block I had trouble with (Below). This is how I thought the code should have looked like, with the filter applied in the Void Draw.

void draw() {
 scale(2);
 opencv.loadImage(video);

 image(video, 0, 0 );

 noFill();
 stroke(0,0,0);
 strokeWeight(1);
 Rectangle[] faces = opencv.detect();
 println(faces.length);
 filter(GRAY);
 filter(BLUR,4);

 for (int i = 0; i < faces.length; i++) {
 println(faces[i].x + "," + faces[i].y);
 rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
 }
}

But as with most things in the digital programming world, it wasn’t as simple as that. All I would come out with was a low frame rate window with both of my chosen filters applied to the entire display window. The re-draw was being applied to everything (this is when I realised there was something drastically wrong with what I was doing). The approach I had been trying obviously wasn’t going to work, or at least the code wasn’t placed or even written in a way for it to support this kind of function. I would have to try something else.

I will continue reading and looking into this problem, updates will follow on my progress.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s