This week I want to show you something neat. There is a number called Phi, the golden ratio that was discovered by the Greeks the Ratio is as follows
(A+B)/A = A/B
Phi turns out to be 1.61803399...
This Ratio was used to build the Pyramids, the Parthenon and is found is good design even today.
So I wanted to see if there was a way I can use this ratio with facial detection. In openCV you can use Haar cascade to find parts of the face
like so
Promising right?!?!
Well unfortunately you are seeing a lot of redundancy and false positives in that images, some of the boxes around the eye might actually be determined when looking for a mouth. Luckily the general face detector is pretty good, and if you use the biggest box you get have a decent start.
By using the face rectangle's height as a starting point I could extrapolate the width of the face with Phi
Coincidentally the line separating A and B tends to lie where the eyes are on the face. So I extrapolated some more.
Here is the breakdown
Phi A/B = (A+B)/A = 1.618033988749894848204586834
Outer White lines - Detected Facial Height with Haar Cascades (A+B)
Teal Lines - Phi derived Facial Width (Height / phi) (A)
Green Lines - Predicted location of eyes by breaking Height into A + B
Blue lines - Predicted eye and mouth width (B = A')
Red + Inner White line - Predicted mouth height (A'' + B'' = A' = B)
Red line - Predicted nose height (A'')
Purple line - Predicted nose width (B'')
Teal circles - Best possible eye locations using Phi in conjunction with Haar Cascades.
Interesting huh?!?! Most interesting Phi can be used to help find the best rectangle for certain facial features.
If you'd like to see more images check out my Facebook site
Or
Check out a Presentation I made posted at
See you in Twenty Six Weeks
No comments:
Post a Comment