Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ida和bda矩阵的意义是什么? #10

@ww249

Description

@ww249

..\AeDet\layers\backbones\lss_fpn.py中有这样一段代码:

def get_geometry(self, sensor2ego_mat, intrin_mat, ida_mat, bda_mat):
    """Transfer points from camera coord to ego coord.

    Args:
        rots(Tensor): Rotation matrix from camera to ego.
        trans(Tensor): Translation matrix from camera to ego.
        intrins(Tensor): Intrinsic matrix.
        post_rots_ida(Tensor): Rotation matrix for ida.
        post_trans_ida(Tensor): Translation matrix for ida
        post_rot_bda(Tensor): Rotation matrix for bda.

    Returns:
        Tensors: points ego coord.
    """
    batch_size, num_cams, _, _ = sensor2ego_mat.shape

    # undo post-transformation
    # B x N x D x H x W x 3
    points = self.frustum
    ida_mat = ida_mat.view(batch_size, num_cams, 1, 1, 1, 4, 4)
    points = ida_mat.inverse().matmul(points.unsqueeze(-1))
    # cam_to_ego
    points = torch.cat(
        (points[:, :, :, :, :, :2] * points[:, :, :, :, :, 2:3],
         points[:, :, :, :, :, 2:]), 5)

    combine = sensor2ego_mat.matmul(torch.inverse(intrin_mat))
    points = combine.view(batch_size, num_cams, 1, 1, 1, 4,
                          4).matmul(points)
    if bda_mat is not None:
        bda_mat = bda_mat.unsqueeze(1).repeat(1, num_cams, 1, 1).view(
            batch_size, num_cams, 1, 1, 1, 4, 4)
        points = (bda_mat @ points).squeeze(-1)
    else:
        points = points.squeeze(-1)
    return points[..., :3]

any apply is appreciated!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions