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
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
| Field | Type | Default | Description |
|---|---|---|---|
sampler | str | "volume_sampler" | "shell_sampler" or "volume_sampler". |
number_of_views | int | 1 | Views rendered per scene. |
params | dict | None | None | Parameters 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.
| Parameter | Default | Description |
|---|---|---|
center | None | None: 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_max | 0.4, 0.6 | Distance from the center in meters. |
elevation_min, elevation_max | -90.0, 90.0 | Angle above the horizontal plane. 0–90 stays above the scene. |
azimuth_min, azimuth_max | -180.0, 180.0 | Angle around the vertical axis. |
inplane_rot_min, inplane_rot_max | -60.0, 60.0 | Camera 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.
| Parameter | Default | Description |
|---|---|---|
point_of_interst | None | Where 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_size | None | Box size [x, y, z] in meters. None: the bounding box of the visible models. |
volume_center | None | Box center. None: the center of that bounding box. |
distance_range | None | [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.0 | Camera roll. |
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},
)