Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Multi-detection #4

Open
Domingo-montes opened this issue Dec 31, 2012 · 14 comments
Open

Multi-detection #4

Domingo-montes opened this issue Dec 31, 2012 · 14 comments

Comments

@Domingo-montes
Copy link

I finded where to put comments but no familiarized with GitHUb already!!!

I mean the script will can detect more than one face on a pic, like some others around the web..

@mauricesvay
Copy link
Owner

This library can only detect one face. Multiple face detection hasn't been implemented.

@roborourke
Copy link

Hey Maurice,

I've had an idea about how to detect multiple faces by clearing the area of the canvas where one has been detected already and then rescanning. Can you give me any tips as to whether that's just crazy talk or where you'd start if you were going to implement it?

@roborourke
Copy link

Hello again,

I've got multi-face detection working on my fork https://github.com/sanchothefat/php-facedetection/blob/master/FaceDetector.php

It's not perfect by any stretch. Overlapping face areas are a problem that I'm not too sure how to work around yet..

@mauricesvay
Copy link
Owner

The original Javascript implementation had multiple face detection. You might look at it. Your fork is a pretty cool hack however :)

@roborourke
Copy link

Merci :)

I'll check out the JS version. I've made a simple plugin that uses face detection in WordPress while it's cropping images here.

@jostie
Copy link

jostie commented Mar 6, 2013

Sanchothefat, can't you make the square smaller before removing it. Small enough to stop the recognition but leaving other faces detectable?

@roborourke
Copy link

@jostie I don't remove the face but rather remember where it is and skip those points on the image. It's by no means perfect but I wasn't getting consistent results when I skipped over only half of a detected face for example. I couldn't pin down exactly how much face was enough to trigger detection in the end so I kept it simple. If you can figure it out let me know!

If you absolutely require face detection you'd have better luck using opencv directly with a php interface library if there is one. The php implementation is unfortunately very slow to run.

@migandhi
Copy link

migandhi commented Jan 8, 2014

Example code for multi-detect faces https://drive.google.com/uc?authuser=0&id=0B3IOYEdd-pYSU2N5WTRHYWpfTW8&export=download , the name of the file is hard-coded as in the original sample. I have solved it painlessly , and continued detecting other faces. I didn't have any clue of the above comments. I have just color-filled the rectangle of the face,which allowed further detection. Drawback: here would be that a face may be cut and miss detection due to overlapped region of detection

@paskuale75
Copy link

@migandhi I tried your code, it seems a little too slow, however, are continuing to develop it or is it still? thanks ;)

@mauricesvay
Copy link
Owner

If you have some spare time, you might want to have a look at the original JS implementation this lib was ported from: https://gist.github.com/mauricesvay/8332158

It had multi-face detection, but I only had the time to port the code for 1 face. It is probably more efficient to finish the port than to launch the 1-face detector multiple times.

@migandhi
Copy link

migandhi commented Jan 9, 2014

Here an improvement that I see is that the image can be scaled to a thumbnail and then detection can proceed which doesn't have many pixels to scan....// exhaustive, but slow multiscale_detect() is the comment the coder has left in the .js ... that gives count of faces, then using that count the 1 face detection can be looped

@migandhi
Copy link

migandhi commented Jan 9, 2014

and further improvement can be to scale up the same image co-ordinates if they can be mapped to the larger version

@mauricesvay
Copy link
Owner

The PHP version already downsamples the image to perform face detection: https://github.com/mauricesvay/php-facedetection/blob/master/FaceDetector.php#L72-L83

@migandhi
Copy link

migandhi commented Jan 9, 2014

// exhaustive, but slow multiscale_detect() https://gist.github.com/mauricesvay/8332158 in the .js is very true and can't be improved.. return ($this->face['w'] > 0) is the terminating condition as I have guessed it to be. if further scientific interest persists then FFT and Filters can be developed in a laboratory kind of environment... which I assume is available for free in colleges and other research facilities. Intel is a giant and can afford everything.. affordability does come as a constraint

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants