-
Notifications
You must be signed in to change notification settings - Fork 254
Multi-detection #4
Comments
This library can only detect one face. Multiple face detection hasn't been implemented. |
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? |
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.. |
The original Javascript implementation had multiple face detection. You might look at it. Your fork is a pretty cool hack however :) |
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. |
Sanchothefat, can't you make the square smaller before removing it. Small enough to stop the recognition but leaving other faces detectable? |
@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. |
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 |
@migandhi I tried your code, it seems a little too slow, however, are continuing to develop it or is it still? thanks ;) |
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. |
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 |
and further improvement can be to scale up the same image co-ordinates if they can be mapped to the larger version |
The PHP version already downsamples the image to perform face detection: https://github.com/mauricesvay/php-facedetection/blob/master/FaceDetector.php#L72-L83 |
// 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 |
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..
The text was updated successfully, but these errors were encountered: