我试图使用KITTI来做深度单目视觉测量,我尝试使用这个存储库
它使用以下代码将体式转换为6 6DoF
def get6DoFPose(self, p):
pos = np.array([p[3], p[7], p[11]])
R = np.array([[p[0], p[1], p[2]], [p[4], p[5], p[6]], [p[8], p[9], p[10]]])
angles = self.rotationMatrixToEulerAngles(R)
return np.concatenate((pos, angles))
def isRotationMatrix(self, R):
Rt = np.transpose(R)
shouldBeIdentity = np.dot(Rt, R)
I = np.identity(3, dtype=R.dtype)
n = np.linalg.norm(I - shouldBeIdentity)
return n < 1e-6
def rotationMatrixToEulerAngles(self, R):
assert (self.isRotationMatrix(R))
sy = math.sqrt(R[0, 0] * R[0, 0] + R[1, 0] * R[1, 0])
singular = sy < 1e-6
if not singular:
x = math.atan2(R[2, 1], R[2, 2])
y = math.atan2(-R[2, 0], sy)
z = math.atan2(R[1, 0], R[0, 0])
else:
x = math.atan2(-R[1, 2], R[1, 1])
y = math.atan2(-R[2, 0], sy)
z = 0
return np.array([x, y, z], dtype=np.float32)同样,模型输出采用相同的格式(6 6DoF)
问题是如何评估6 6DoF结果,因为此评估工具(基蒂-奥多姆)只支持以下两种格式
# First format: skipping frames are allowed
99 T00 T01 T02 T03 T10 T11 T12 T13 T20 T21 T22 T23
# Second format: all poses should be included in the file
T00 T01 T02 T03 T10 T11 T12 T13 T20 T21 T22 T23 发布于 2022-01-09 00:47:40
您的模型输出是相对位置与欧拉角的旋转,连接到平移。
为了进行评估,你必须:
Tk = Trel @ Tk-1
第一个绝对位置取决于您的数据集和您想要做的工作。默认情况下,基绝对位置是2-D数组4x4,对角线上的位置是对角位置,其他位置是零(在numpy np.eye(4)中),因此要按顺序转换整个相对位置,需要将多个基绝对位置转换为所有相对位置。
Tk5 = Trel @ Tk4 #其中Trel是帧4和5之间的相对位置
我认为阅读这个主题和参考链接可以帮助你:视觉测定仪
https://stackoverflow.com/questions/63473136
复制相似问题