Calculate Distance to Object in Android knowing the Size, Focal Length
I'm trying to find the distance to an object with my Android.
I know the real size of object, also done some camera calibration with OpenCV to calculate focal length, camera matrix and distortion parameters as well. To easy up the question, it's assumed that the orientation is 0 degrees (can compute the angle of the android device when detecting the object)
My previous method was using some sort of manual calibration: - Calculated the area in pixels at several known distances and saved both values (area and distance). Every time I see the object i compute a regression based on the area measured. But this method is obviously inaccurate.
So based in the parameters I know that I mentioned above, what do you recommend as best method?