Skip to content

CameraPoseRandomizer ​

SUMMARY

Samples the camera pose for each rendered view. With number_of_views=N, every randomized scene is rendered from N different viewpoints, which is the cheapest way to multiply your image count: one scene setup (and one physics simulation) yields N labeled images.

Usage ​

python
from telekinesis.illusion import config
from telekinesis.illusion.randomizer.randomizer_node import CameraPoseRandomizer

randomizer.add(
    CameraPoseRandomizer(config.CameraPoseRandomizerConfig(
        sampler="shell_sampler",
        number_of_views=3,
        params={"radius_min": 0.4, "radius_max": 0.7, "elevation_min": 30.0, "elevation_max": 85.0},
    )),
    "camera",
)

Add it as the last node, so the camera aims at models that are already placed.

CameraPoseRandomizerConfig ​

FieldTypeDefaultDescription
samplerstr"volume_sampler""shell_sampler" or "volume_sampler".
number_of_viewsint1Views rendered per scene.
paramsdict | NoneNoneParameters of the chosen sampler, below. Converted to a ShellSamplerConfig or VolumeSamplerConfig; unknown keys are rejected.

Samplers ​

Both samplers aim the camera at a point of interest, by default the center of the visible models, and add a random roll around the viewing axis. Angles are in degrees.

shell_sampler: orbit the models ​

Places the camera on a spherical shell around a center: distance, elevation and azimuth are drawn from the ranges. Use it for object-centric data, where every view should frame the parts.

ParameterDefaultDescription
centerNoneNone: center of the visible models. A list of model-name prefixes, e.g. ["plastic_bin_"]: center of those models. Or [x, y, z].
radius_min, radius_max0.4, 0.6Distance from the center in meters.
elevation_min, elevation_max-90.0, 90.0Angle above the horizontal plane. 0–90 stays above the scene.
azimuth_min, azimuth_max-180.0, 180.0Angle around the vertical axis.
inplane_rot_min, inplane_rot_max-60.0, 60.0Camera roll.

volume_sampler: a camera above the work area ​

Places the camera inside a box and points it at a point of interest. Use it for top-down setups, such as a camera mounted above a bin, where the viewpoint varies in a bounded region.

ParameterDefaultDescription
point_of_interstNoneWhere the camera looks. None: center of the visible models; a list of model-name prefixes; or [x, y, z]. The key really is spelled point_of_interst.
volume_sizeNoneBox size [x, y, z] in meters. None: the bounding box of the visible models.
volume_centerNoneBox center. None: the center of that bounding box.
distance_rangeNone[min, max] distance to the point of interest in meters. None: derived from the lens so the models fit in frame.
inplane_rot_min, inplane_rot_max-60.0, 60.0Camera roll.
python
config.CameraPoseRandomizerConfig(
    sampler="volume_sampler",
    number_of_views=2,
    params={"point_of_interst": [0.0, 0.0, 0.0], "distance_range": [0.4, 0.9], "inplane_rot_min": -30.0, "inplane_rot_max": 30.0},
)
Custom Nodes
Add any other axis of variation in a few lines.
Write a node →