Ask Your Question
0

How to determine the distance between the camera and the face in Android?

asked 2014-07-08 14:29:00 -0600

Nishant gravatar image

updated 2014-07-08 14:30:13 -0600

I am new to openCV, I want to determine the distance between the android phones front camera and the face detected.

Is there any way to get the dimensions of the face?

Thanks.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-07-08 15:21:03 -0600

Witek gravatar image

Find out what is the average distance between human eyes, eyes and mouth and based on that and your camera resolution you can estimate the camera-face distance.

edit flag offensive delete link more

Comments

Can you please tell me the formula or any link so that I can refer it to.Thanks

Nishant gravatar imageNishant ( 2014-07-14 11:12:12 -0600 )edit

Hi Witek. Can you please send me any link or tell me the formula. I have distance between the eyes and eyes-mouth. I have focal length of the camera. How to go ahead now.

Nishant gravatar imageNishant ( 2014-07-15 13:50:52 -0600 )edit

I don't think there is/you need a special formula for that. If, say, average eye distance is 5 cm, get something that is 5 cm long or print a pattern with two dots 5 cm apart. Then take a few snapshots from known distances (say, 50 cm apart) and measure the eye distance/dots displacement in pixels. Cover the entire range within which you will identify faces - this will not be too far, probably a few meters max. Put the data into a chart and you will see the relation of the detected eye distance in pixels to the distance of the observed face from the camera. Average face. Face that is looking straight into the camera. To get more robust results, use eye-mounth distance as well. For far away faces, when you cannot identify eyes, use the entire size of the head/face for rough results.

Witek gravatar imageWitek ( 2014-07-15 17:35:12 -0600 )edit
0

answered 2014-07-09 11:51:00 -0600

updated 2014-07-14 12:26:08 -0600

Hi Nishant,

You will be needing stereo images to find the distance.Calibrate your camera using OpenCV only. Get the intrinsic parameters which include the focal length and all. Create a disparity map using StereoBM or Stereo_SGBM, With the help of that depth map try to find the final distance.

As requested these links might help you:

  1. http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

  2. http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration

  3. http://www.jayrambhia.com/blog/stereo-calibration/

  4. http://blog.martinperis.com/2011/01/opencv-stereo-camera-calibration.html

  5. http://abhishek4273.wordpress.com/2014/07/09/playing-with-stereo-images-and-depth-map/

  6. http://abhishek4273.wordpress.com/2014/02/20/camera-calibration-using-opencv/

edit flag offensive delete link more

Comments

Hi Abhishek

I am new to OpenCV. If possible can you please give me the links so that I can refer it to.Thanks

Nishant gravatar imageNishant ( 2014-07-14 12:08:47 -0600 )edit

I have added links. :)

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-07-14 12:29:26 -0600 )edit

Thanks Abhishek

Nishant gravatar imageNishant ( 2014-07-14 12:32:27 -0600 )edit

Question Tools

Stats

Asked: 2014-07-08 14:29:00 -0600

Seen: 4,486 times

Last updated: Jul 14 '14