Open
Description
🐛 Bugs / Unexpected behaviors
opencv_from_cameras_projection does not return correct calibration matrix if PerspektiveCamera was configured using a calibration matrix.
Instructions To Reproduce the Issue:
from pytorch3d.utils.camera_conversions import opencv_from_cameras_projection
from pytorch3d.renderer import PerspectiveCameras
calibration_matrix = torch.tensor(
[
[
[150.0, 0.0, 300.0, 0],
[0.0, 150.0, 300.0, 0],
[0.0, 0.0, 0.0, 1],
[0.0, 0.0, 1.0, 0],
],
[
[51515.0, 51.0, 12.0, 0],
[486.0, 1.0, 545.0, 0],
[896.0, 41.0, 1.0, 1],
[13.0, 61.0, 1.0, 14],
],
]
)
cams = PerspectiveCameras(K=calibration_matrix)
camera_matrix = opencv_from_cameras_projection(cams, image_size=torch.tensor([[600, 600]]))[2]
assert torch.any(camera_matrix[0] != camera_matrix[1]) # fails as both are equal