Skip to content

posing

posing #

posed and reposed — images carrying the poses a model solved for them.

posed(images, model) #

The registered images as frames at the poses model solved, without depth.

An image the model did not register is left out, so the result may be shorter than images.

Parameters:

Name Type Description Default
images Array[Image]

The images the model was reconstructed from, in its order.

required
model Reconstruction

The reconstruction.

required
Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/posing.py
@cg.pure_function("sfm.posed/1")
def posed(images: cg.Array[cg.Image], model: Reconstruction) -> cg.Array[PosedImage]:
    """The registered ``images`` as frames at the poses ``model`` solved, without depth.

    An image the model did not register is left out, so the result may be
    shorter than ``images``.

    Args:
        images: The images the model was reconstructed from, in its order.
        model: The reconstruction.
    """
    frames = [
        PosedImage(image=image, pose=model.cameras[camera_key(index)], depth=cg.Missing)
        for index, image in enumerate(images)
        if not cg.is_missing(model.cameras[camera_key(index)])
    ]
    cg.logging.info("Posed images", registered=len(frames), images=len(images))
    return cg.Array[PosedImage](frames)

reposed(frames, model) #

frames with each registered one moved to the pose model solved for it.

A frame the model did not register keeps its prior pose; every frame keeps its image and its depth.

Parameters:

Name Type Description Default
frames Array[PosedImage]

The posed images the model was built from, in its order.

required
model Reconstruction

The reconstruction.

required
Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/posing.py
@cg.pure_function("sfm.reposed/1")
def reposed(frames: cg.Array[PosedImage], model: Reconstruction) -> cg.Array[PosedImage]:
    """``frames`` with each registered one moved to the pose ``model`` solved for it.

    A frame the model did not register keeps its prior pose; every frame
    keeps its image and its depth.

    Args:
        frames: The posed images the model was built from, in its order.
        model: The reconstruction.
    """
    moved = 0
    result: list[PosedImage] = []
    for index, frame in enumerate(frames):
        pose = model.cameras[camera_key(index)]
        if cg.is_missing(pose):
            result.append(frame)
            continue
        moved += 1
        result.append(PosedImage(image=frame.image, pose=pose, depth=frame.depth))
    cg.logging.info("Reposed frames", moved=moved, frames=len(frames))
    return cg.Array[PosedImage](result)