How to measure distance between vehicle using camera

I am currently studying DNNInference.cpp to find a distance to a perceived vehicle.

We want to find the actual vehicle size (such as 1.6m) not perceived as the size of the image (short length such as 3,4 cm) when perceiving the vehicle. However, to analyze the entire source code, This lack is in difficulty.

What I want to know is the vehicle’s actual horizontal and vertical lengths and x, y center coordinates.
After analyzing the source code, I could get the answer from the function below.

interpretOutput (std :: vector * bboxes,
const float32_t * outConf, const float32_t * outBBox,
const dwRect * const roi,
bool doClustering)

In the above function, we want to know what parameter is the variable that plays the role of the actual vehicle size.

I will be waiting for your answer. Thank you.

Hello there,

Seems we are looking for the same Graal :p.
Did you find something giving a perception of the distance to any detected objects ?
Or do you try to get the car coordinates and dimensions to derivate its distance from his bounding box’s size ?

Thank you for your help.


I have same question. Meanwhile, as plan B I made a simple code to estimate object distance from camera simply by using bounding box dimension but I’m not sure about it’s performance. I’m wondering if there is a ready to use method or function doing this task. Noting was found in DW samples.

Yea, I implemented the same plan B…