CVBpy 15.0
cvb/MultiPart
1# CVBpy Example Script for multi part image
2#
3# 1. Open the device with 3rd generation acq stack.
4# 2. Get the composite stream
5# 3. Acquire composites
6# 4. Get the parts of a composite
7# 5. Check the type of the part
8#
9# Requires: A connected and configured GenICam device which has multipart composites
10
11import cvb
12
13devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
14with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device:
15 stream = device.stream(cvb.CompositeStream)
16 stream.start()
17 for _ in range(10):
18 composite, status, node_maps = stream.wait()
19 with composite:
20 for part in composite:
21 if isinstance(part, cvb.Image):
22 img: cvb.Image = part
23 print(f"Part of image is of type IMAGE: {img.width}x{img.height}")
24 # using this you can check for all the different types that could be in the composite
25 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