For a PiCamera fixed to a bot with a fixed/known pointing angle, the distance to the bottom line of the image is a known, fixed number.
I have a PiCam v1.3 on my bot:
5MP 1080p30 2592 x 1944 pixels
35mm focal length equiv.
focus 1 m to inf.
H 53 deg x V 41 deg
f/2.9
(Use 1296 x 976 and 2x2 binning for better low light SNR)
Let's use 2 feet at 30 degrees from horizontal as the lowest/closest visible point at the center of the bottom of the image, and the camera mounted 6" off the floor, with a fictional image size of 410 pixels. Each 10 pixels above the bottom of the image is one degree less angle with two known angles (for triangle with x,y,h sides - angle y-h and 90 degree angle x-y.) With two angles and the included side y=6", we learned in school how to compute that, but I don't remember how, only that it was possible when I was a teenager!
Today we use the internet:
https://www.mathsisfun.com/algebra/trig ... ngles.html