-1
$\begingroup$

I would like to know how to calculate the distance to each car when I run my application for an autonomous vehicle in real time. In addition I want to know how implement the calculation in C++.

You can see in the images we can know the distance for each vehicle but I don't know what code I should use to make all these calculations for every vehicle .

Please check the photo to understand more about what I'm trying to achieve.

autonomous vehicle obstacle detection

autonomous vehicle obstacle detection (2)

$\endgroup$
  • $\begingroup$ I'm not sure what you need help with. You say towards the middle of the question, You can see in the images we can know the distance for each vehicle, but in the beginning you ask, I would like to know how to calculate the distance to each car. Do you know the distances to each car or not? $\endgroup$ – Chuck Sep 2 '15 at 13:15
  • $\begingroup$ we are building a software for the autonomous vehicle and this software was writing by other company, and i want to know how did they made the calculation for the distance as you could see in the images. $\endgroup$ – assam alzookery Sep 2 '15 at 14:46
  • $\begingroup$ Well they're doing the measurements wrong, so I wouldn't try to use them or recreate them. For instance, in the top picture, "Pedestrian", which looks like a light pole, is at minus 0.41, while the white car beside it is at 0.26 and the red car closer to the camera is at -0.3. Similarly, in the second image, the middle car is at a negative value while the cars closer and further away are both at positive values. $\endgroup$ – Chuck Sep 2 '15 at 18:26
  • $\begingroup$ Are you sure the numbers above each detection are distances? They could also be some confidence metric. $\endgroup$ – Ben Sep 4 '15 at 15:32
1
$\begingroup$

From the images, I am assuming you do not have a multi camera setup.

So, the short answer, based on the information I think you have, you cannot. In an ideal scenario, if you know the calibration parameters of the camera, you could use the distance to a known object to compute the scale factor. But in this case, you do not have a fixed object in each image.

However, having said this, you should understand that longitudinal distance computation using single camera systems are generally error prone in the real world.(as you can see from the distance measurements in the images). This can be attributed to the non uniformity of objects as well as varying illumination conditions.

A more constrained case would be to track only objects moving in the same direction as the host. In that case, you could try to detect the labe markers(they generally have a uniform width, length and distance between them) and use the principles of similar triangles to compute the distance to the target vehicle.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.