1 | initial version |
This is one of the hard problems of computer vision. There are three ways to do it.
One: Know the actual dimensions of your object, and of the camera. Placing calibration markers on the object is a variant of this. Use your trigonometry to find the size, or the aruco module to use calibration markers.
Two: Use a method of finding camera position (calibration pattern, laser sensor, ect) and the motion of the camera to triangulate the object's position and find the distance. Use the Camera Calibration module to do this.
Three: Use lots of camera motion and a structure from motion algorithm to reconstruct both the camera path and a 3d model of the environment. Use the SfM module to do this.