camera.CameraSampler

Generate a physically accurate to capture visual data from your simulation.

This module provides extensive control over your camera's intrinsics, extrinsics. The following examples demonstrate and document all currently available camera parameters.

{
  "module": "camera.CameraSampler",
  "config": {
    "cam_poses": [
      {
        "number_of_samples": 5,
        "location": {
          "provider": "sampler.Conical3d",
          "radius_bottom": 15.0,
          "radius_top": 15.0,
          "z_bottom": 0.0,
          "z_top": 5.0,
          "degrees_start": 269.0,
          "degrees_end": 271.0,
          "noise": 0.0,
          "axis_up": [0, 1, 0]
        },
        "rotation": {
          "format": "override_world_matrix",
          "value": {
            "provider": "getter.POI"
          },          
          "inplane_rot": {
            "provider": "sampler.Value",
            "type": "float",
            "min": 0,
            "max": 0
          }
        },
        "shift": 0.0,
        "fov": 0.8,
        "resolution_x": 1024,
        "resolution_y": 1024,
        "fov_is_half": false,
        "pixel_aspect_x": 1.0,
        "clip_start": 0.2,
        "clip_end": 2000.0,
        "stereo_convergence_mode": "PARALLEL",
        "convergence_distance": 1.8,
        "interocular_distance": 0.06,
        "dof_dynamic_focus": false,
        "aperture_fstop": 2.8,
        "aperture_blades": 6,
        "aperture_ratio": 1.005,
        "aperture_rotation": 1.0,
        "dof_random_focus": true,
        "dof_random_focus_obj_names": [
          "baseball",
          "glove"
        ]
      }
    ]
  }
}

NOTE: Parameter names with a forward slash indicate a nested parameter. For example, "rotation/value":

{
  "rotation": {
    "value": {
      "provider": "getter.POI"
    }
  }
}

Camera Sampler Parameters

  • "source_frame": Type: List of Strings. Can be used if the given positions and rotations are specified in frames different from the Blender frame, specified in the format of [x, y, z]. Values can be negative or positive for each dimension:

    • "X" or "-X"

    • "Y" or "-Y"

    • "Z" or "-Z"

  • "cam_poses": Type: List of Dicts. A list of camera poses in which various properties may be set.

  • "default_cam_param": Type: Dict. A dict which can be used to specify properties across all camera poses.

The following properties may be specified either in "default_cam_param" or as a dict in "cam_poses":

  • "location": Type: Vector. The position of the camera, specified as a list of three values (xyz). Typically, a sampler is used to provide this value.

  • "location/axis_up": Type: Vector. The up axis of the camera, required only if "rotation/format" is set to "override_world_matrix" (default: [0, 0, 1]).

  • "rotation/value": Type: Vector/List. Specifies the rotation of the camera. Per default rotations are specified as three euler angles.

  • "rotation/format": Type: String. Describes the form in which the rotation is specified. Can be one of the following:

    • "euler": Three Euler angles

    • "forward_vec": Specified with a forward vector where the Z axis is assumed as the up vector

    • "look_at": Camera will be turned such as it looks at 'value' location, which can be defined as a fixed or sampled XYZ location.

    • "override_world_matrix": Similar to "look_at", but can have its up axis ("location/axis_up") defined as well instead of assuming the Z axis as the up axis.

  • "rotation/inplane_rot": Type: Float. A rotation angle in radians around the camera's forward axis (default: 0.0)

  • "fov": Type: Float. The FOV, normally the angle between both sides of the frustum, if "fov_is_half" is true then its assumed to be the angle between the forward vector and one side of the frustum (default: 0.691111). NOTE: Do not use if "cam_K" is defined.

  • "cam_K": Type: List. 3x3 camera intrinsic matrix (default: []).

  • "resolution_x": Type: Integer. Width resolution of the camera (default: 512).

  • "resolution_y": Type: Integer. Height resolution of the camera (default: 512).

  • "cam2world_matrix": Type: List of Floats. 4x4 camera extrinsic matrix (default: []).

  • "fov_is_half": Type: Boolean. Set to true if the given FOV specifies the angle between a forward vector and one side of the frustum (default: false).

  • "pixel_aspect_x": Type: Float. "Pixel aspect ratio (default: 1.0).

  • "clip_start": Type: Float. Near clipping distance (default: 0.1).

  • "clip_end": Type: Float. Far clipping distance (default: 1000.0).

  • "stereo_convergence_mode": Type: String. How the two cameras converge (e.g. off-axis where both cameras are shifted inwards to converge in the convergence plane, or parallel where they do not converge and are parallel (default: "OFFAXIS")). Can be either of the following:

    • "OFFAXIS"

    • "PARALLEL"

  • "convergence_distance": Type: Float. The convergence point for the stereo cameras (i.e. distance from the projector to the projection screen (default: 1.95)).

  • "interocular_distance": Type: Float. "Distance between the camera pair (default: 0.065).

  • "dof_distance": Type: Float. Distance of depth of field.

  • "dof_dynamic_focus": Type: Boolean. "Dynamically focus camera on a cluster of objects (default: false).

  • "dof_dynamic_object": Type: String. The name of the object or empty to focus on (default: "dof_dynamic_object").

  • "dof_random_focus": Type: Boolean. If true this will set dof focus on a randomly selected non occluded object.

  • "dof_random_focus_obj_names": Type: List of Strings. A list of object names to use in choosing a random object to focus on.

  • "aperture_fstop": Type: Float. F-Stop ratio that defines the amount of blurring. Lower values give a strong depth of field effect (default: 5.2) Typical values range between 1.4 and 32.0.

  • "aperture_blades": Type: Integer. Total number of polygonal blades used to alter the shape of the blurred objects in the render, and render preview. As with the viewport, the minimum amount of blades to enable the bokeh effect is 3, resulting in a triangular-shaped blur (default: 0).

  • "aperture_ratio": Type: Float. Change the amount of distortion to simulate the anamorphic bokeh effect. A setting of 1.0 shows no distortion, where a number below 1.0 will cause a horizontal distortion, and a higher number will cause a vertical distortion (default: 1.0).

  • "aperture_rotation": Type: Float. Rotate the polygonal blades about the camera's forward axis (from -3.14159 to 3.14159, default: 0.0).

Last updated