Skip to content

CameraPoseRandomizer

Samples one camera pose per view and keyframes it, so a single randomized scene yields several images.

python
from telekinesis.illusion.randomizer.randomizer_node import CameraPoseRandomizer

CameraPoseRandomizer(
    pose_sampling_function,   # callable returning (location, euler_angles)
    number_of_views=0,        # rendered images per scene
    **kwargs,                 # forwarded to the sampling function
)

Parameters

ParameterTypeDescription
pose_sampling_functionCallable[..., tuple[np.ndarray, np.ndarray]]Returns a location and XYZ Euler angles. Receives the Context as context plus every keyword argument passed to the node.
number_of_viewsintNumber of camera poses sampled per scene, and therefore images rendered per scene.
**kwargsForwarded verbatim to the sampling function on every call.

Camera Pose Samplers

Ready-made samplers live in telekinesis.illusion.sampler.camera_pose_sampler:

python
from telekinesis.illusion.sampler.camera_pose_sampler import (
    shell_sampler,
    volume_sampler,
)

shell_sampler places the camera on a spherical shell around a center point:

ParameterTypeDefaultDescription
centernp.ndarray | list[str] | NoneNoneThe point the shell is centered on, or the names of the objects to center on.
radius_min / radius_maxfloat0.4 / 0.6Bounds on the camera distance from the center, in meters.
elevation_min / elevation_maxfloat-90.0 / 90.0Bounds on the elevation angle, in degrees.
azimuth_min / azimuth_maxfloat-180.0 / 180.0Bounds on the azimuth angle, in degrees.
inplane_rot_min / inplane_rot_maxfloat-60.0 / 60.0Bounds on the in-plane camera rotation, in degrees.

volume_sampler places the camera inside a volume and orients it towards a point of interest:

ParameterTypeDefaultDescription
point_of_interstnp.ndarray | list[str] | NoneNoneThe point the camera looks at, or the names of the objects to look at.
volume_sizetuple[float, float, float] | NoneNoneSize of the sampling volume. Derived from the scene when omitted.
volume_centernp.ndarray | NoneNoneCenter of the sampling volume.
distance_rangetuple[float, float] | NoneNoneBounds on the camera distance from the point of interest.
inplane_rot_min / inplane_rot_maxfloat-60.0 / 60.0Bounds on the in-plane camera rotation, in degrees.

Usage

python
randomizer.add_randomizer(
    randomizer_node=CameraPoseRandomizer(
        pose_sampling_function=shell_sampler,
        number_of_views=2,
        radius_min=0.5,
        radius_max=0.7,
    ),
    node_name="camera_pose_randomizer",
)

Next Steps