如何将像素转换为Kitti数据集中的仪表?

发布于 2025-02-13 09:25:40 字数 1528 浏览 1 评论 0原文

我已经检查了相关的主题,但是它们都没有回答我的问题。我已经使用Kitti数据集用于我的神经网络,我在检测对象时没有问题。我唯一不明白的是我已经在像素中获得了对象的距离,但是我不知道如何将它们转换为仪表? 我要转换为米的值:

class 0 class 1 distance  is: 184.33062561920545
class 0 class 2 distance  is: 59.157488166238295
class 1 class 2 distance  is: 241.9236599379254

我使用“ dist_calculator”代码获得的值:

0.45786248198605186
0.4417580846368999
0.4642980966255596

我找到了以下代码,但是由于它不使用校准数据文件,所以我认为这是错误的。请指导我

def dist_calculator(startX, startY, endX, endY, box_width, box_height, img_w, img_h):

x_3, y_3 = startX, endY - (box_height / 7)  # top left of the triangle
# assumption: camera is rasied above the ground so considering 90% of the height of the image 
height
x_1, y_1 = img_w / 2, 0.9 * img_h  # bottom of the triangle
x_2, y_2 = endX, endY - (box_height / 7)  # top right of the triangle

# find the angle between bottom and right point
angle_x1_x2 = math.degrees(math.atan2(x_1 - x_2, y_1 - y_2))
# find the angle between bottom and left point
angle_x1_x3 = math.degrees(math.atan2(x_1 - x_3, y_1 - y_3))

angle_right = 90 + angle_x1_x2
angle_left = 90 - angle_x1_x3

# total angle of view for the bench from bottom center point of the image.
total_angle = angle_right + angle_left

# Bench length assumed to be 2 metersin millimeters. This value can automated, based on the 
 type of bench used.
 bench_length = 2000

 distance = (bench_length * (1 / total_angle) * 57) / 1000

#print(total_angle)
print(distance)

return total_angle, distance

I have checked the related topics but none of them answered my question.I have used kitti dataset for my neural network, I have no problem in detecting objects. The only thing I don't understand is that I have obtained the distance of objects in pixels, but I don't know how to convert them to meters?
The values I want to convert to meters:

class 0 class 1 distance  is: 184.33062561920545
class 0 class 2 distance  is: 59.157488166238295
class 1 class 2 distance  is: 241.9236599379254

The values I obtained using the "dist_calculator" code:

0.45786248198605186
0.4417580846368999
0.4642980966255596

I have found the following code, but because it does not use the calibration data file, I think it is wrong.please guide me

def dist_calculator(startX, startY, endX, endY, box_width, box_height, img_w, img_h):

x_3, y_3 = startX, endY - (box_height / 7)  # top left of the triangle
# assumption: camera is rasied above the ground so considering 90% of the height of the image 
height
x_1, y_1 = img_w / 2, 0.9 * img_h  # bottom of the triangle
x_2, y_2 = endX, endY - (box_height / 7)  # top right of the triangle

# find the angle between bottom and right point
angle_x1_x2 = math.degrees(math.atan2(x_1 - x_2, y_1 - y_2))
# find the angle between bottom and left point
angle_x1_x3 = math.degrees(math.atan2(x_1 - x_3, y_1 - y_3))

angle_right = 90 + angle_x1_x2
angle_left = 90 - angle_x1_x3

# total angle of view for the bench from bottom center point of the image.
total_angle = angle_right + angle_left

# Bench length assumed to be 2 metersin millimeters. This value can automated, based on the 
 type of bench used.
 bench_length = 2000

 distance = (bench_length * (1 / total_angle) * 57) / 1000

#print(total_angle)
print(distance)

return total_angle, distance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文