Open hht1996ok opened 1 year ago
@tingtingliangvs
Could you tell me why the rotation matrix of the point cloud is like this when axis==0.
def rotate(self, rotation, axis=None): """Rotate points with the given rotation matrix or angle. Args: rotation (float, np.ndarray, torch.Tensor): Rotation matrix or angle. axis (int): Axis to rotate at. Defaults to None. """ if not isinstance(rotation, torch.Tensor): rotation = self.tensor.new_tensor(rotation) assert rotation.shape == torch.Size([3, 3]) or \ rotation.numel() == 1
if axis is None:
axis = self.rotation_axis
if rotation.numel() == 1:
rot_sin = torch.sin(rotation)
rot_cos = torch.cos(rotation)
if axis == 1:
rot_mat_T = rotation.new_tensor([[rot_cos, 0, -rot_sin],
[0, 1, 0],
[rot_sin, 0, rot_cos]])
elif axis == 2 or axis == -1:
rot_mat_T = rotation.new_tensor([[rot_cos, -rot_sin, 0],
[rot_sin, rot_cos, 0],
[0, 0, 1]])
elif axis == 0:
rot_mat_T = rotation.new_tensor([[0, rot_cos, -rot_sin],
[0, rot_sin, rot_cos],
[1, 0, 0]])
else:
raise ValueError('axis should in range')
rot_mat_T = rot_mat_T.T
elif rotation.numel() == 9:
rot_mat_T = rotation
else:
raise NotImplementedError
self.tensor[:, :3] = self.tensor[:, :3] @ rot_mat_T
Thank you for your contribution to the community. In this data enhanced code, why does the rotation angle of point take a negative value while box takes a positive value.
@PIPELINES.register_module() class GlobalRotScaleTransBEV: def init(self, resize_lim, rot_lim, trans_lim, is_train): self.resize_lim = resize_lim self.rot_lim = rot_lim self.trans_lim = trans_lim self.is_train = is_train