Skip to content

Is there any example of how to create pycolmap.Image and add to pycolmap.Reconstruction? #3522

@wzy-99

Description

@wzy-99

Hello, the latest pycolmap is not able to set cam_from_world. The new freature supports Rig and Frame.

But I dont know how to use these, is there any example?

My scene has just a camera.

I have written some code:

         camera = pycolmap.Camera(
                model=camera_type, width=image_size[0], height=image_size[1], params=pycolmap_intri, camera_id=fidx + 1
            )
        reconstruction.add_camera(camera)

        rig = pycolmap.Rig()
        rig.rig_id = fidx + 1
        sensor_t = pycolmap.sensor_t()
        sensor_t.id = camera.camera_id
        rig.add_sensor(sensor_t, pycolmap.Rigid3d())
        reconstruction.add_rig(rig)

        frame = pycolmap.Frame()
        frame.frame_id = fidx + 1
        frame.rig_id = rig.rig_id
        frame.rig = rig
        rotation = pycolmap.Rotation3d(extrinsics[fidx][:3, :3])
        translation = extrinsics[fidx][:3, 3]
        rigid3d = pycolmap.Rigid3d(rotation, translation)
        frame.set_cam_from_world(camera_id=camera.camera_id, cam_from_world=rigid3d)
        reconstruction.add_frame(frame)

        image = pycolmap.Image(
            image_id=fidx + 1, name=f"image_{fidx + 1}", camera_id=camera.camera_id, frame_id=frame.frame_id
        )
        reconstruction.add_image(image)

But it doest work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions