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, OutputPixelFormat.
  • 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.IDSU336L0CX(name="my_ids_camera")
    try:
        camera.connect(serial_number="4108615854")

        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.Zivid2M70(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. OutputPixelFormat (e.g. "RGB_8") sets the image pipeline's output format. Auto toggles such as ExposureAuto take "Off", "Once", or "Continuous", and a manual value such as ExposureTime is only writeable while its auto toggle is "Off".
  • 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.

The host-side calibration parameters intrinsic_matrix, distortion_coefficients, and extrinsic_matrix can be set on any camera, even while it is disconnected; writing them never pushes them to the device. Connected to a simulated camera, device parameters cannot be written and raise NotImplementedError.

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

Parameter Configuration ​

ParameterTypeDefaultDescription
namestrrequiredName of the parameter to write. Same names as get_parameter.
valuebool | int | float | str | datetime.timedeltarequiredNew value. IDS: bool for BooleanNode, int/float for numeric nodes, str (symbolic value) for EnumerationNode. Zivid: float/int or datetime.timedelta depending on the parameter.
acquisition_indexint0Zivid only. Index of the acquisition to modify for HDR captures; ignored for global parameters. Not accepted by IDS.

Returns ​

TypeDescription
Noneset_parameter() has no return value; pair it with get_parameter to confirm the new value.

Raises ​

ExceptionCondition
KeyErrorname is not a known parameter for the camera.
RuntimeErrorIDS only — the camera is not connected, or the node is not available/writeable.
TypeErrorIDS only — value has the wrong Python type for the node.
ValueErrorIDS only — value is out of range or not a valid enumeration entry.
IndexErrorZivid only — acquisition_index exceeds the number of acquisitions in the current settings.
NotImplementedErrorA device parameter is written while connected to a simulated camera.

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.