Configuring a Video Capture Device

This section contains a small example program showing how to configure a video capture device through the PropertyMap interface.

The article Accessing Device Properties explains the capabilities of the property classes in detail.

Open a Device

For demonstration purposes, we open the first available video capture device:

import imagingcontrol4 as ic4

# Initialize library
ic4.Library.init()

# Create a Grabber object
grabber = ic4.Grabber()

# Open the first available video capture device
first_device_info = ic4.DeviceEnum.devices()[0]
grabber.device_open(first_device_info)

Configure the Resolution

Next, we configure the device to output Mono8 data with a ROI of 640x480:

# Configure the device to output images in the Mono8 pixel format
grabber.device_property_map.set_value(ic4.PropId.PIXEL_FORMAT, ic4.PixelFormat.Mono8)

# Set the resolution to 640x480
grabber.device_property_map.set_value(ic4.PropId.WIDTH, 640)
grabber.device_property_map.set_value(ic4.PropId.HEIGHT, 480)

Define ROI Origin

Then, the origin of the ROI is moved to the top left corner of the sensor:

# Set the origin of the ROI to the top-left corner of the sensor
grabber.device_property_map.set_value(ic4.PropId.OFFSET_AUTO_CENTER, "Off")
grabber.device_property_map.set_value(ic4.PropId.OFFSET_X, 0)
grabber.device_property_map.set_value(ic4.PropId.OFFSET_Y, 0)

Set an Exposure Time

Finally, we configure the device to a fixed exposure time of 5ms and enable automatic gain control:

# Configure the exposure time to 5ms (5000µs)
grabber.device_property_map.set_value(ic4.PropId.EXPOSURE_AUTO, "Off")
grabber.device_property_map.set_value(ic4.PropId.EXPOSURE_TIME, 5000.0)

# Enable GainAuto
grabber.device_property_map.set_value(ic4.PropId.GAIN_AUTO, "Continuous")