Skip to content

Save Settings

SUMMARY

Save Settings writes the camera's current in-memory configuration to a .yml file. The output format is compatible with Zivid Studio, so you can import saved settings back into the GUI for visual inspection or further tuning.

Available on: Zivid.

The Skill

python
camera.save_settings("my_custom_settings.yml")

The path argument accepts a str or pathlib.Path. The file must have a .yml extension — a ValueError is raised otherwise. If the file already exists it will be overwritten with a warning.

The Code

python
"""
Load settings, adjust parameters, and save the result to a new file.
"""
import datetime
import pathlib
from loguru import logger

from telekinesis.medulla.cameras import zivid

SETTINGS_PATH = pathlib.Path(__file__).resolve().parent / "settings_inspection_far.yml"
OUTPUT_PATH = pathlib.Path(__file__).resolve().parent / "my_custom_settings.yml"


def main():
    camera = zivid.Zivid(name="my_zivid_camera")
    try:
        camera.connect()
        camera.load_settings(SETTINGS_PATH)

        # Fine-tune parameters
        camera.set_parameter("aperture", 5.6)
        camera.set_parameter("exposure_time", datetime.timedelta(microseconds=20000))
        camera.set_parameter("color_gain", 2.0)

        # Save the modified settings
        camera.save_settings(OUTPUT_PATH)
        logger.info(f"Settings saved to {OUTPUT_PATH}")
    finally:
        camera.disconnect()


if __name__ == "__main__":
    main()

The Explanation of the Code

After connect has initialised the Zivid SDK and load_settings has applied a base configuration, individual parameters are adjusted with set_parameter. save_settings then writes the full configuration — including modifications — to a .yml file.

python
camera.save_settings(OUTPUT_PATH)

The saved file can be:

  • Loaded back in a future script with load_settings.
  • Imported into Zivid Studio via File → Import Capture Settings for visual inspection.
  • Version-controlled alongside your project code for reproducible captures.

Where to Use the Skill

  • Preserving tuned parameters — after adjusting settings programmatically, save them so the same configuration can be reloaded without repeating the tuning.
  • Sharing configurations — export a settings file that teammates can import into Zivid Studio or their own scripts.
  • A/B testing — save multiple settings variants and compare capture results across them.