herosdevices.hardware.allied_vision.vimba_camera

Driver for cameras based on the Allied Vision VimbaX library.

Module Contents

herosdevices.hardware.allied_vision.vimba_camera.DEFAULT_FEATURE_VISIBLIY
herosdevices.hardware.allied_vision.vimba_camera.DEFAULT_CONFIG
class herosdevices.hardware.allied_vision.vimba_camera.VimbaCompatibleCamera(cam_id: str, config_dict: dict, default_config: str | None = None, reset_to_continuous: bool = False, lib_path: str | None = None)[source]

Bases: herosdevices.core.templates.camera.CameraTemplate

A class to interface with Allied Vision VimbaX cameras.

The class provides functionality to control and capture images from Allied Vision VimbaX cameras. It manages camera configuration, acquisition, and data streaming.

Important

The vendor underlying library must be obtained from the official website. Download the Allied Vision VimbaX SDK, unpack it and install it following the supplied README file.

Note:

For use with BOSS in docker, you can adapt the VimbaX install script cti/Install_GenTL_Path.sh

To find the cam_id of your camera, you can either use the VimbaXViewer (or start the driver with a wrong id, it will print the available ids). The ids look something like DEV_000A4717239E.

cam_id
default_config_dict
reset_to_continuous = False
read_feature(feature_name: str) Any[source]

Read the current value of a VimbaX camera feature.

Parameters:

feature_name – Name of the feature to read (e.g., “ExposureTime”, “Gain”)

Returns:

The current value of the feature, or False if the feature cannot be read. For enum features, returns the string representation of the enum value.

Example

Read exposure time:

exposure = camera.read_feature("ExposureTime")
print(f"Current exposure: {exposure} µs")
set_feature(feature_name: str, value: Any) bool[source]

Set the value of a VimbaX camera feature.

Warning

This method is discouraged for production use. Instead, use the configuration system via set_configuration() which provides better configuration management.

Parameters:
  • feature_name – Name of the feature to set (e.g., “ExposureTime”, “Gain”)

  • value – Value to set for the feature

Returns:

True if the feature was set successfully, False otherwise.

Example

Set exposure time:

success = camera.set_feature("ExposureTime", 1000)
if not success:
    print("Failed to set exposure time")
run_feature(feature_name: str) Any[source]

Execute a command-type VimbaX camera feature.

Command features are used for actions like triggering software triggers, saving settings, or other one-time operations.

Parameters:

feature_name – Name of the command feature to execute (e.g., “TriggerSoftware”)

Returns:

True if the feature was ran successfully, False otherwise.

Example

Trigger a software trigger:

result = camera.run_feature("TriggerSoftware")
if result:
    print("Trigger executed successfully")
get_config_features(max_visibility_level: vmbpy.FeatureVisibility | int = DEFAULT_FEATURE_VISIBLIY) dict[source]

Get all features from the camera in form of a dict including information about if they can be set/read.

Parameters:

max_visibility_level – Maximum visibility level for features to include (1=Beginner, 2=Expert, etc.)

get_camera
acquisition_running: bool = False
payload_metadata: dict
keep_device_open = True
default_config: str
get_device() collections.abc.Iterator[None]

Yield a device handle.

# use the device in a with statement
with self.get_device() as camera:
    camera.do_something()
open() Any

Open the device handler and assign it to self._device.

teardown() None

Release the device handler and potentially de-initialize the API.

start() bool

Fire a software trigger.

Returns:

True if successful

stop() bool

Abort the exposure and release queued buffers.

Returns:

True if successful

reset() None

Reset the device by aborting any ongoing exposure, closing and re-opening the handler.

get_status() dict

Get a dict with the current device status.

Returns:

A dict with the device status

property config_dict: dict

Get a copy of the configuration dict.

Returns:

Copy of the configuration dict

update_configuration(new_config_dict: dict, merge: bool = True) None

Update the configuration dict with new configuration.

Each dict key corresponds a (new) configuration name. Each value is a dict with config property -> config value.

Parameters:
  • new_config_dict – A dict of configurations where the keys are the configuration names

  • merge – If True, the new dict is recursively merged with the current set config dict. If False the old configurations with the provided names (keys) are overwritten.

get_configuration() dict

Get the currently active configuration.

Returns:

The currently active configuration.

configure(config: str = '', metadata: dict | None = None) bool

Configure the device with the known configuration config.

To add a configuration to the device, use update_configuration().

Parameters:
  • config – Key (name) of the configuration

  • metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted acquisition_data event.

set_configuration
update_payload_metadata(metadata: dict, merge: bool = True) None

Update metadata dict send with every emitted frame by the acquisition_data event method.

Parameters:
  • metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted acquisition_data event.

  • merge – If True, the new dict is merged with the current set metadata dict. If False the old metadata is overwritten by the given dict.

arm(metadata: dict | None = None, kill_running: bool = False) bool

Arm the device with the currently active configuration.

Parameters:
  • metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted acquisition_data event.

  • kill_running – If True any running acquisition will be stopped. If False and an acquisition is

  • running (already)

  • raised. (an error will be)

Returns:

True if arming was successful else False

acquisition_data(frame: numpy.ndarray, metadata: dict | None = None) tuple

Event to emit new frames.

Note

The dtype of the frame is not changed here.

Parameters:
  • frame – The frame payload data (for example an image or an scope trace)

  • metadata – The metadata which is passed along the payload. This argument takes precedence over the payload_metadata attribute (for example set by the update_payload_metadata method) while merging the two dicts.

Returns:

A tuple of image and metadata(-dict)

acquisition_started(metadata: dict | None = None) dict

Event emitted when the acquisition thread starts.

Returns:

A dict with acquisition metadata

acquisition_stopped(metadata: dict | None = None) dict

Event emitted when the acquisition thread stops.

Returns:

A dict with acquisition metadata