logo

OpenMV中tag.x_translation的单位是什么?

2026-01-22 17:52
0
0r036s9z4b4u

OpenMV中tag.x_translation的单位是什么?

用户询问在使用OpenMV的find_apriltags()函数进行姿态估计时,tag.x_translation的单位是什么。

import sensor, image, time, math

sensor.reset()

sensor.set_pixformat(sensor.RGB565)

sensor.set_framesize(sensor.QQVGA)

sensor.skip_frames(30)

sensor.set_auto_gain(False)

sensor.set_auto_whitebal(False)

clock = time.clock()

f_x = (2.8 / 3.984) * 160

f_y = (2.8 / 2.952) * 120

c_x = 160 * 0.5

c_y = 120 * 0.5

def degrees(radians):

	return (180 * radians) / math.pi

while(True):

	clock.tick()

	img = sensor.snapshot()

	for tag in img.find_apriltags(fx=f_x, fy=f_y, cx=c_x, cy=c_y):

		img.draw_rectangle(tag.rect, color = (255, 0, 0))

		img.draw_cross(tag.cx, tag.cy, color = (0, 255, 0))



		print_args = (tag.x_translation, tag.y_translation, tag.z_translation, \

			degrees(tag.x_rotation), degrees(tag.y_rotation), degrees(tag.z_rotation))

		print("Tx: %f, Ty %f, Tz %f, Rx %f, Ry %f, Rz %f" % print_args)
	print(clock.fps())
  • tag.x_translation 表示 AprilTag 在相机坐标系下 X 方向的平移量
  • 单位是米(meters)
  • 该值基于相机内参(fx, fy, cx, cy)和物理焦距计算得出
  • 同理,tag.y_translation 和 tag.z_translation 的单位也是米
0
0r036s9z4b4u

单位是啥啊

2026-01-23 17:14
Z
星小瞳xs

单位未知,需要自行测量:

image — 机器视觉 — MicroPython 1.22 文档