Face recognition

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Face recognition

Post by JayBird »

I was browsing a website earlier today that had pictures of people that looked like famous people and it got me thinking.

Imagine a website where a user could upload an image of their face. The image is analysed and returns pictures of other users that look like you.

I haven't ever had the need to use this image functions in PHP, so i don't know what is possible, thats why i have posted here.

Maybe it would need to be combined with some kind of Java applet where people could identify their key points, like nose and eyes and ears.

Perhaps some number could be generated by the positioning of the points in relations to each other, and so returns images which have a very similar number!?!?

They are just a couple of my thoughts.

Just interested to peoples thoughts on whether this would actually be possible!?

Mark
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

I'm posting this again :(. LOL, anyhow; maybe PHP can break apart the images into Pixels. Then compare the color, tone and positions to the other images from a database.

With millions of people - this is an extremely slow process.

-Nay
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

i think your idea is somewhat flored from the start.

Imagine the amount of different phtotos, all with different background colours and taken with differnet camera with different lighting. Comparing tones wouldn't be an option.

Face recognition usually analyses the position of main features on the face like your eyes (how far apart they are, where they are in relation to your nose). Position of ears etc etc...

This is the route i think this idea will need to go down.

Mark
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

what if i'm looking sideways? what if there's no enough light in the room? this is an extreme difficult task, to compare you to someone else, there would have to be millions of people's photos in a database, and will be so SLOW just cheking up ONE image... do you imagine the time it will take to look over millions of binary files? is GD that fast to do the job? can a java applet work nicely to achive a high percent of perfection while looping throught billons of bytes, just that quick?

Submit your image, we will send you the results as soon as we finish processing your image after... 4 days later, sorry, we couldn't find even a result

are you going to beat CIA,FBI or the police's fingerprint system?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Face recognition might not be such an impossible task.

You might look for gradients - perhaps ignoring colour altogether and concentrating on pixel brightness. From that you could build a gradient map.

The maps would (somehow) need to be scale-less to take account of different image sizes. Maybe each pixel - or 4x4 area or whatever the optimal unit is - would know where it was in relation to an origin and the other pixels, using percentages rather than any unit of measurement.

Gradient maps comparisons would need to take account of the fact that the origins won't match by default. Something akin to regex with gradients instead of string patterns. Maybe you would start by looking for a match for a short "string" and, if successful, look for progressively larger matches.

Also, even the same picture reproduced with different contrast would produce a different gradient map, so you'd need to somehow look at the changes in brightness "loosely", ie looking for matching gradients regardless of the brightness variance amplitude. Initially you could check to see if each neighbouring area is "up" "down" or "same" compared to a neighbour, then maybe factor in the amplitude in stages to attempt to find a stronger match.

The maths and not the programming would probably be the crucial aspect of the puzzle.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Face recognition will always be extremely hard to get it working exactly how you want it. related: http://computer.howstuffworks.com/facia ... nition.htm
Image Image
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post by trollll »

For the application Bech100 described, it wouldn't really have to worry about lots of different angles. It could do a quick test to locate facial features and spit out an error if you didn't have a basic head shot it could at least crop to. Wouldn't make much sense to compare with a database of pictures taken at completely different angles unless you planned to expand the application to use cameras in public.

At any rate, I think you have a very possible (albeit frightening) idea. Haven't done a lot of work with images using PHP, but it seems like you could pull it off without needing to resort to another language (unless it would really make more sense to do the actual recognition algorithms in Java or C++ for the sake of efficiency).
stephenv
Forum Newbie
Posts: 2
Joined: Thu Oct 09, 2003 7:33 pm

Post by stephenv »

With facial recognition, you create a map of a face, and store the map coordinates in the db, then you compare against coordinates.

As it has been said, the face would have to be a front on shot, side shots would probably have to include an algorithm to determine how much of an angle the shot is at, anything over 20% would probably be really hard to calculate.

You would want to shrink the image so that the width or height is always the same, then map distances from features: head (width at eyes, width at mouth) eyes (outside, inside), nose (width height), mouth (width, center), and their location on the face.

Comparing this to a db would be a lookup process that determines percentage accuracy required. You would not want to deconstruct pictures in realtime.
Post Reply