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
- 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/).
- get the width approximation based on survey data and user details from backend DB.
- get the Focal length approximated based on average human hand distance OR can use the approx. FOV to calculate the focal length. (https://learnopencv.com/approximate-focal-length-for-webcams-and-cell-phone-cameras/).
- Make an algo to adjust the Focal-length/pixels w.r.t. the width provided from user details.
- Fix the width after initiating the script.
- Use
Numpyto get the n-D Array of all frames and then find the most similar arrays and pick any 3 centre weighted array as your best frame. - If the
stdis not more than some upper limit than continue to distance estimation else, redo the whole to get lessstd.
References:
- https://www.pyimagesearch.com/2015/01/19/find-distance-camera-objectmarker-using-python-opencv/
- https://github.com/pablovela5620/Hand-Detection-and-Distance-Estimation
- https://thesai.org/Downloads/Volume9No9/Paper_77-Deep_Learning_based_Object_Distance_Measurement.pdf
- https://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/
- https://github.com/NVlabs/ffhq-dataset # Dataset (FACE)
- https://www.researchgate.net/figure/Average-face-index-average-width-and-average-height-along-with-the-face-classifications_tbl4_289499995
- '893' image has Focal Length: 426.6666666666667 [[2503 1602] [2503 1559] [2631 1559] [2631 1602]]
- '1069' image has Focal Length: 1105.8103434244792 [[2506 2123] [2411 1598] [2738 1539] [2833 2064]]
- '1125' image has Focal Length: 516.6666666666666 [[2233 1061] [2233 1007] [2388 1007] [2388 1061]]
