Skip to content

Perspektive Camera does not extract focal_lenght and principal_point from calibration matrix #1106

Open
@WeberSamuel

Description

@WeberSamuel

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalebugSomething isn't workingdo-not-reapDo not delete this pull request or issue due to inactivity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions