Inspiration

To eliminate the usage of any extra hardware for face to camera distance calculation, I present an approach that accurately calculates the distance from the face to the camera.

How does it work

I've used a mathematical approach which is called triangle similarity for calculating the distance. The triangle similarity goes something like this: Let’s say we have a marker or object with a known width W. We then place this marker some distance D from our camera. We take a picture of our object using our camera and then measure the apparent width in pixels P. This allows us to derive the perceived focal length F of our camera:

F = (P x D) / W I can apply the triangle similarity to determine the distance of the object to the camera:

D’ = (W x F) / P

Challenges and Requirements:

Focal length calculation requires object bbox and Distance to calibrate and compute the Focal length. We can use research surveys to get estimated head/{or any} sizes according to age & gender (https://pubmed.ncbi.nlm.nih.gov/18727867/), OR we can use the NN to get width estimation inplace. what we are doing is not true camera calibration. True camera calibration involves the intrinsic parameters of the camera (http://www.vision.caltech.edu/bouguetj/calib_doc/).

Try Now!

link

Built With

Share this project:

Updates