Skip to content

Set Parameter

SUMMARY

Set Parameter updates a named camera parameter — for example exposure time, acquisition frame rate, or device link throughput limit. Pair it with get_parameter to verify that the write took effect.

Available on: IDS, Zivid.

The Skill

python
camera.set_parameter("ExposureTime", 35000.0)

The parameter name must be a valid key for the camera being used — passing an unknown name raises a KeyError.

  • IDS — common names: AcquisitionFrameRate, ExposureTime, DeviceLinkThroughputLimit.
  • Zivid — common names: aperture, exposure_time, gain, brightness, color_aperture, color_exposure_time, color_gain, color_brightness, noise_threshold, outlier_threshold. See the full list on the Zivid page.

The Code

python
"""
Tune exposure and frame rate on an IDS camera before capturing or streaming.

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

from telekinesis.medulla.cameras import ids


def main():
    camera = ids.IDS(
        name="my_ids_camera",
        serial_number="4108909352",
        load_factory_defaults=False,
    )
    try:
        camera.connect()

        logger.info(f"ExposureTime (before): {camera.get_parameter('ExposureTime')}")
        camera.set_parameter('ExposureTime', 35000.0)
        camera.set_parameter('AcquisitionFrameRate', 14.0)
        logger.info(f"ExposureTime (after): {camera.get_parameter('ExposureTime')}")
    finally:
        camera.disconnect()


if __name__ == "__main__":
    main()
python
"""
Tune acquisition parameters on a Zivid camera before capturing.
"""
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"


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

        logger.info(f"aperture (before): {camera.get_parameter('aperture')}")
        camera.set_parameter("aperture", 5.6)
        camera.set_parameter("exposure_time", datetime.timedelta(microseconds=10000))
        camera.set_parameter("color_gain", 2.0)
        logger.info(f"aperture (after): {camera.get_parameter('aperture')}")
    finally:
        camera.disconnect()


if __name__ == "__main__":
    main()

The Explanation of the Code

After connect has opened the device, set_parameter writes a new value to the named parameter. The most common use is tuning exposure and gain before capturing.

Per-camera behavior:

  • IDS — writes to the IDS Peak SDK. Values take effect immediately on the next capture. With load_factory_defaults=False, parameters previously configured in IDS Peak Cockpit are preserved across connect calls.
  • Zivid — writes to the in-memory settings object. For HDR captures with multiple acquisitions, pass acquisition_index to target a specific acquisition (default 0). Global parameters like noise_threshold ignore the index. Settings can also be loaded from a YAML file with load_settings or saved with save_settings.

Passing an unknown name raises a KeyError immediately. Pair the write with a get_parameter call to verify the new value took effect.

Where to Use the Skill

  • Tuning exposure for the lighting in your cell — adjust ExposureTime to avoid blown-out highlights or underexposed regions.
  • Throttling frame rate — set AcquisitionFrameRate to limit bandwidth or sync with downstream consumers.
  • Bandwidth control — adjust DeviceLinkThroughputLimit when streaming over USB3 to multiple cameras at once.
  • Remote tuning over BabyROS — see Publish Video with BabyROS for the client-side pattern that wraps set_parameter in a BabyROS request.