CVBpy 15.0
All Classes Namespaces Functions Variables Enumerations Enumerator Properties Modules Pages
cvb/MultiPart
1# @brief Example for acquiring multi part images.
2
3# CVBpy Example Script for multi part image
4#
5# 1. Open the device with 3rd generation acq stack.
6# 2. Get the composite stream
7# 3. Acquire composites
8# 4. Get the parts of a composite
9# 5. Check the type of the part
10#
11# Requires: A connected and configured GenICam device which has multipart composites
12
13import cvb
14
15devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
16with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device:
17 stream = device.stream(cvb.CompositeStream)
18 stream.start()
19 for _ in range(10):
20 composite, status, node_maps = stream.wait()
21 with composite:
22 for part in composite:
23 if isinstance(part, cvb.Image):
24 img: cvb.Image = part
25 print(f"Part of image is of type IMAGE: {img.width}x{img.height}")
26 # using this you can check for all the different types that could be in the composite
27 stream.abort()
The composite stream class.
Definition: __init__.py:841
Union[cvb.GenICamDevice, cvb.VinDevice, cvb.EmuDevice, cvb.VideoDevice, cvb.NonStreamingDevice] open(str provider, int acquisition_stack=cvb.AcquisitionStack.PreferVin)
Opens a device with the given provider and acquisition stack.
Definition: __init__.py:1629
List[cvb.DiscoveryInformation] discover_from_root(int flags=cvb.DiscoverFlags.FindAll, int time_span=300)
Discovers available devices / nodes depending on the given flags.
Definition: __init__.py:1609
The Common Vision Blox image.
Definition: __init__.py:2097