JustinK101 Posted August 1, 2007 Share Posted August 1, 2007 Hello, I am looking into using PHP (GD Library) to scan images and locate a face inside an image. What is the technique to do this? Example: Let's say I am given an image which shows a figure photographed from the waist up, how can I locate the face in the image? I have been told to look into Fast Fourier Transforms (FFTs) perhaps? Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/ Share on other sites More sharing options...
cooldude832 Posted August 1, 2007 Share Posted August 1, 2007 don't know if gd has it, but maybe you can make a psedo magic wand tool like photoshop has to select the outline so to speak, it will not be perfect, but you can probably get it to track a line around by using a neighboring pixel idea. like if pixel 5,5 is black then check if any of the 9 surronding are black if so then you start this multi directional testing until you find all lines (greater than 1 point) that navigate from the start point and all the way around back to it. It be a challenge but it could be done if you can read on a pixel to pixel level. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-312562 Share on other sites More sharing options...
JustinK101 Posted August 2, 2007 Author Share Posted August 2, 2007 Any body else have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313681 Share on other sites More sharing options...
Crew-Portal Posted August 2, 2007 Share Posted August 2, 2007 Do it cooldude832 way, cause I think that is most probable! -- OR -- Drink alot of beer and fall asleep in front of your computer and hope that when you wake up in the morning its done! Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313684 Share on other sites More sharing options...
ss32 Posted August 2, 2007 Share Posted August 2, 2007 This is, unfortunately, the sort of application that people spend years developing and tuning. if you wish to proceed, you are going to need to do a lot of research on this topic- it isnt easy. the good thing, though, is that it has been developed, the only problem is that you will have to do a lot of work to get some source code. http://computer.howstuffworks.com/facial-recognition.htm Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313752 Share on other sites More sharing options...
btherl Posted August 2, 2007 Share Posted August 2, 2007 I did some face recognition research while at uni. What's in the public domain is complex, crude and not very effective. The reason is that an effective face recognition system has enourmous value, and will be snapped up by the government or military immediately. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313758 Share on other sites More sharing options...
onlyican Posted August 2, 2007 Share Posted August 2, 2007 If you think about using an image editor such as Macromedia (sorry Adobe) Fireworks or Adobe Photoshop. The only way you would be able to cut a face (or any object) from the image is IF the background is a pure colour. Even then you could still have problems. I personally think you would have too many problems trying to do this using website programming. I would suggest trying something which is built more for this sort of stuff such as Flash or Java (Not JavaScript, Java) Maybe adding the same crop tool. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313765 Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 You need to scan the image for skin tones (difficult as there are lots if them for each creed!). how ever you can plot the areas of an image that have a skin tone and assume that the largest one is the face - this depends on the image having one face - mulitple faces requires a bit more thought... I'll have a look for the functions to scan the colours... brb. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313820 Share on other sites More sharing options...
onlyican Posted August 2, 2007 Share Posted August 2, 2007 But if you look at an image of a face, the face itself can hold multiple skin tones. You think, your eyes Your hair Your Lips All of these are Different colours Also need to think of the following Cheeks normally redder (or if Asian / black then darker) than rest of face Some photos, the nose comes out almost white (Not sure about black people) This is programming think now. Logical. I want to crop my face out of an image I would get a picture of myself with the background a solid bright colour (White or something) Then I would upload this into my image editor Then I would crop the BACKGROUND not the face Then Delete the background, (Should only have me left) Then I would have to manually crop my face from my body Use this logic for your application. Stop trying to work out how to get a face Try and work out how to delete the background. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313846 Share on other sites More sharing options...
mrjcfreak Posted August 2, 2007 Share Posted August 2, 2007 Giving folks a crop utility is (although not what you ideally want) pragmatically the best option. There are loads of ajax/php utilities out there, and it would involve adding only one extra step to whatever process is involved, be it registration or whatever. Google uses it for picture choosing in Gmail, for example. Using GD to scan pixels individually and work out areas would, aside from being insanely memory/CPU intensive, be so hit and miss you would need to have a human check each one, and I would guess, 9 times out of 10 ask it to try again- much better and faster to go for the user crop method. Quote Link to comment https://forums.phpfreaks.com/topic/62780-locate-a-face-in-an-image-using-php-gd/#findComment-313877 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.