Skip to content

Load Settings

SUMMARY

Load Settings reads a .yml settings file and applies it to the camera's in-memory configuration. The file format matches the one exported by Zivid Studio, so you can tune settings visually, export them, and replay them in code without manual parameter entry.

Available on: Zivid.

The Skill

python
camera.load_settings("settings_inspection_far.yml")

The path argument accepts a str or pathlib.Path. The file must exist and be a valid Zivid settings YAML. A TypeError is raised for invalid path types and a ValueError for paths that do not exist.

The Code

python
"""
Capture a colour-mapped point cloud from a Zivid camera and
visualise it in Rerun.

Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import pathlib
import datetime
from loguru import logger

import rerun as rr
import rerun.blueprint as rrb

from telekinesis.medulla.cameras import zivid

ZIVID_EXAMPLES_DIR = pathlib.Path(__file__).resolve().parent


def main():
    camera = zivid.Zivid(name="my_zivid_camera")

    try:
        blueprint = rrb.Blueprint(
            rrb.Horizontal(
                rrb.Spatial3DView(name="Default settings", origin="capture_1"),
                rrb.Spatial3DView(name="High gain",        origin="capture_2"),
            )
        )
        rr.init("Zivid_Pointcloud_Example", spawn=True)
        rr.send_blueprint(blueprint)
        rr.log("/", rr.ViewCoordinates.RDF, static=True)

        camera.connect()
        settings_path = ZIVID_EXAMPLES_DIR / "settings_inspection_far.yml"
        camera.load_settings(settings_path)

        point_cloud = camera.capture_pointcloud()
        if point_cloud is None:
            logger.error("Failed to capture point cloud.")
            return
        rr.log(
            "capture_1/pointcloud",
            rr.Points3D(positions=point_cloud.positions, colors=point_cloud.colors)
        )

        camera.set_parameter("color_gain", 16.0)
        camera.set_parameter("exposure_time", datetime.timedelta(microseconds=100000), 2)

        point_cloud = camera.capture_pointcloud()
        if point_cloud is None:
            logger.error("Failed to capture point cloud.")
            return
        rr.log(
            "capture_2/pointcloud",
            rr.Points3D(positions=point_cloud.positions, colors=point_cloud.colors)
        )
    except Exception as e:
        logger.error(
            f"Unable to capture point cloud. Caught exception: {type(e).__name__}: {e}"
        )
    finally:
        rr.disconnect()
        camera.disconnect()


if __name__ == "__main__":
    main()

The Explanation of the Code

After connect has initialised the Zivid SDK, load_settings replaces the camera's default configuration with the settings stored in the YAML file. This is the recommended way to configure a Zivid camera — tune settings interactively in Zivid Studio, export them via File → Export Capture Settings, and load them in your script.

python
camera.load_settings(SETTINGS_PATH)

The settings file controls all 3D and 2D acquisition parameters (aperture, exposure time, gain, brightness), processing filters (noise removal, outlier removal, smoothing), and engine selection (phase or stripe). After loading, individual parameters can still be fine-tuned with set_parameter.

Once settings are loaded, any capture method (capture_color_image, capture_depth_image, capture_pointcloud) uses the loaded configuration.

Where to Use the Skill

  • Reproducible captures — load the same settings file across scripts and machines to ensure consistent image quality.
  • Multi-scene workflows — switch between settings files (e.g. settings_inspection_far.yml vs settings_consumer_goods_quality.yml) depending on the task.
  • Quick iteration — tune in Zivid Studio, export, and re-run the script without editing code.