Object Distance Estimation
Last updated
Last updated
This module shows you how to estimate the distance of a detected game element.
For mono camera depth estimation use this tutorial:
The following tutorial only covers finding the object's distance on the z-axis (how far in front the object is compared to the camera). However to navigate to the object we will need the distances on the x and y axis (how far the object is to the side of the camera and above the camera). Our code will implement the specified additions. For more information on the derivation of these equations, refer to page 5 of this paper:
Here are a couple of important notes about the tutorial:
The focal length for your webcam can easily be found through a simple Google search (ex. logitech xyz focal length)
Remember all of the measurement values must be in the same units, so make sure your code converts the units correctly.
To attain the pixel width of the object (object_width_in_frame) you must measure the width of the detected object's bounding box.
Your distance computation code should look something like this: