-2

Possible Duplicate:
iphone app to recognise eyes in a scanned image of a person

I am developing a ipad application in that i need to upload a photo from library or using camera, while uploading i need to take position(points) of the eye to fix my glass how do i achieve this, for example below image shows my needed result when i click the glass it should fix to face in the particular position enter image description here

Community
  • 1
  • 1
ganesh
  • 131
  • 2
  • 11
  • @rasa i have already did the app using some models with points from XML, i just want to know how do i get value(points) while uploading a image, i just need a idea to get points, for my fare english i posted it very clearly dont do too much – ganesh Aug 10 '12 at 07:25
  • See there is only one complication in your project and that is detection of eyes. And for this u need to do some image processing and that is not easy task....I wanted to say with my comment that try something and if u stuck then post doubts specifically. – USER_NAME Aug 10 '12 at 08:30

1 Answers1

1

If I understand your question (and not sure I do) then the built-in face detection in iOS 5 is the way to go. It is fast and very easy to use. When a face is detected in an image, you get CGPoints for the left and right eyes, and the mouth. You also get a CGRect representing a bounding box for the found face. From this you should be able to position your eyeglass images.

There are a bunch of tutorials out there but a most of them are either incomplete or mess up the coordinates. Here's one that is correct: http://nacho4d-nacho4d.blogspot.com/2012/03/coreimage-and-uikit-coordinates.html

One thing to note: the tutorial uses a small image so the resulting coordinates do not have to be scaled to the on-screen (UIImageView) representation of the image. Assuming you use a photo taken with the iPad camera, you will have to scale the coordinates by the amount the source image is scaled (unless you reduce its size before running the face detection routine -maybe not a bad idea). You may also need to rotate the image for the correct orientation.

There is a routine in one of the answers here: UIImagePickerController camera preview is portrait in landscape app

And this answer has a good routine for finding the scale of an image when presented by a UIImageView using 'aspect fit': How to get the size of a scaled UIImage in UIImageView?

Community
  • 1
  • 1
spring
  • 18,009
  • 15
  • 80
  • 160