Skip to content

scene

scene #

scene_dataset — a scene capture's keyframes as posed images.

scene_dataset(capture, max_dimension=1600) #

The keyframes of capture as posed images, resized and carrying their depth.

Poses are ARKit's, metric and shared by every session relocalized into the same world map, so the frames of several sessions concatenate as they are. A frame without intrinsics is left out.

Parameters:

Name Type Description Default
capture SceneCapture

The scene capture.

required
max_dimension int

The longest image side, in pixels, as written.

1600
Source code in capturegraph-lib/capturegraph/recipes/splats/scene.py
@pure_function("splats.scene_dataset/1")
def scene_dataset(capture: SceneCapture, max_dimension: int = 1600) -> Array[PosedImage]:
    """The keyframes of ``capture`` as posed images, resized and carrying their depth.

    Poses are ARKit's, metric and shared by every session relocalized into the
    same world map, so the frames of several sessions concatenate as they
    are. A frame without intrinsics is left out.

    Args:
        capture: The scene capture.
        max_dimension: The longest image side, in pixels, as written.
    """
    frames = [
        frame
        for frame in capture.frames
        if not is_missing(frame.image) and intrinsics(frame.pose) is not None
    ]
    posed: list[PosedImage] = []
    with step("Decoding frames", total=len(frames)) as decoding:
        for frame in decoding.track(frames):
            picture = frame.image.pil(max_axis=max_dimension)
            image = Image.new("jpeg")
            picture.convert("RGB").save(image, quality=JPEG_QUALITY)
            posed.append(
                PosedImage(image=image, pose=at_size(frame.pose, *picture.size), depth=frame.depth)
            )
    return Array[PosedImage](posed)