This section contains a small example program showing how to configure a video capture device through the ic4::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:
static std::vector< DeviceInfo > enumDevices(Error &err=Error::Default())
Get a list of the devices currently attached to the system.
Definition: DeviceEnum.h:480
Represents an opened video capture device, allowing device configuration and stream setup.
Definition: Grabber.h:83
bool deviceOpen(const DeviceInfo &dev, Error &err=Error::Default())
Opens the video capture device specified by the passed device information object.
Definition: Grabber.h:228
Configure the Resolution
Next, we configure the device to output Mono8 data with a ROI of 640x480:
PropertyMap devicePropertyMap(Error &err=Error::Default()) const
Returns the property map for the currently opened video capture device.
Definition: Grabber.h:647
bool setValue(const char *integer_name, int64_t value, Error &err=Error::Default())
Set the value of a property with a known name to the passed integer value.
Definition: Properties.h:2054
constexpr PropIdEnumeration PixelFormat
Format of the pixels provided by the device.
Definition: PropertyConstants.h:1141
constexpr PropIdInteger Height
Height of the image provided by the device (in pixels).
Definition: PropertyConstants.h:926
constexpr PropIdInteger Width
Width of the image provided by the device (in pixels).
Definition: PropertyConstants.h:1381
Define ROI Origin
Then, the origin of the ROI is moved to the top left corner of the sensor:
constexpr PropIdInteger OffsetX
Horizontal offset from the origin to the region of interest (in pixels).
Definition: PropertyConstants.h:1126
constexpr PropIdEnumeration OffsetAutoCenter
Automatically adjust the values of OffsetX and OffsetY to select the center region of the sensor.
Definition: PropertyConstants.h:1121
constexpr PropIdInteger OffsetY
Vertical offset from the origin to the region of interest (in pixels).
Definition: PropertyConstants.h:1131
Set an Exposure Time
Finally, we configure the device to a fixed exposure time of 5ms and enable automatic gain control:
constexpr PropIdEnumeration ExposureAuto
Sets the automatic exposure mode when ExposureMode is Timed.
Definition: PropertyConstants.h:651
constexpr PropIdFloat ExposureTime
Sets the Exposure time when ExposureMode is Timed and ExposureAuto is Off.
Definition: PropertyConstants.h:686
constexpr PropIdEnumeration GainAuto
Sets the automatic gain control mode.
Definition: PropertyConstants.h:801