Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Image Manager/CVBpy/DeviceConfiguration

This example program is located in your CVB installation under %CVB%Tutorial/Image Manager/CVBpy/DeviceConfiguration.

device_configuration.py:

# @brief Example for device configuration.
# CVBpy Example Script
#
# 1. Loads a GenICam device.
# 2. Get the device node map.
# 3. Modify the exposure time node
#
# Requires: A connected and configured GenICam device
import os
import cvb
os.path.join(cvb.install_path(), "drivers", "GenICam.vin"),
cvb.AcquisitionStack.Vin)
dev_node_map = device.node_maps["Device"]
exposure_node = dev_node_map["ExposureTime"]
exposure_node.value = exposure_node.max / 2
print("Exposure time set to: " + str(exposure_node.value) + " " + exposure_node.unit)
Union[cvb.GenICamDevice, cvb.VinDevice, cvb.EmuDevice, cvb.VideoDevice, cvb.NonStreamingDevice] open(str provider, int acquisition_stack=cvb.AcquisitionStack.PreferVin)
str install_path()

with_bufferchange.py:

# CVBpy Example Script for 2nd generation acquisition stack
#
# 1. Loads a GenICam device.
# 2. Get the device node map.
# 3. Modify the pixel format
# 4. Update the buffers
#
# Requires: A connected and configured GenICam device
import cvb
devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.Vin) as device:
stream = device.stream()
stream.start()
# do some acquisition
stream.abort()
nodes = device.node_maps["Device"]
pixel_format = nodes["Std::PixelFormat"]
pixel_format.value = "Mono10"
# update the CVB buffer according to the current device settings
stream.image_rect.update(cvb.DeviceUpdateMode.UpdateDeviceImage)
print("Pixel format set to: {}".format(pixel_format.value))
List[cvb.DiscoveryInformation] discover_from_root(int flags=cvb.DiscoverFlags.FindAll, int time_span=300)

with_flowsetpool.py:

# CVBpy Example Script for 3rd generation acquisition stack
# to show the update of buffer due to changing a parameter
# which affects the buffer size.
#
# 1. Load a GenICam device.
# 2. Get the device node map.
# 3. Modify the pixel format
# 4. Update the buffers
#
# Requires: A connected and configured GenICam device
import cvb
devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device:
stream = device.stream(cvb.ImageStream)
stream.start()
# do some acquisition
stream.abort()
nodes = device.node_maps["Device"]
pixel_format = nodes["Std::PixelFormat"]
pixel_format.value = "Mono10"
# update the flow_set_pool (buffers)
stream.deregister_flow_set_pool()
print("Pixel format set to: {}".format(pixel_format.value))
stream.start()
for i in range(10):
image, status, node_maps = stream.wait()
if status == cvb.WaitStatus.Ok:
print("Acquired image: {0} | Timestamp: {1}".format(i, image.raw_timestamp))
stream.abort()