CVBpy 15.0
cvb/BufferHandling
1# CVBpy Example Script for 3rd generation acquisition stack
2# to show the new buffer handling
3#
4# 1. Loads a GenICam device.
5# 2. Get the device node map.
6# 3. Modify the pixel format
7# 4. Update the buffers
8#
9# Requires: A connected and configured GenICam device
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.ImageStream)
16 stream.register_managed_flow_set_pool(100)
17 print("Buffers allocated: {}".format(stream.flow_set_count))
18 stream.deregister_flow_set_pool()
19 stream.register_managed_flow_set_pool(200)
20 print("Buffers allocated: {}".format(stream.flow_set_count))
21 stream.start()
22 for i in range(10):
23 image, status, node_maps = stream.wait()
24 with image:
25 print("Acquired image: {}".format(i))
26 stream.abort()
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 image stream class.
Definition: __init__.py:2521
1# CVBpy Example Script for 2nd generation acquisition stack
2# to show the ring buffer handling with locking and unlocking
3# buffers.
4#
5# 1. Load a GenICam device.
6# 2. Allocate buffers.
7# 3. Switch the lock mode on.
8# 4. Store images to lock them.
9# 5. Unlock images manually.
10#
11# Requires: A connected and configured GenICam device
12
13import cvb
14
15devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
16with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.Vin) as device:
17 stream = device.stream()
18 stream.ring_buffer.change_count(5, cvb.DeviceUpdateMode.UpdateDeviceImage)
19 stream.ring_buffer.lock_mode = cvb.RingBufferLockMode.On
20 print("Buffers allocated: {0} | Lock mode: {1}".format(stream.ring_buffer.count, stream.ring_buffer.lock_mode))
21 stream.start()
22 images = []
23 for _ in range(10):
24 image, status = stream.wait_for(5000)
25 if status == cvb.WaitStatus.Ok:
26 images.append(image)
27 print("Image list size: {}".format(len(images)))
28 elif (status == cvb.WaitStatus.Timeout and len(images) > 0):
29 first = images.pop(0)
30 first.unlock()
31 print("Image unlocked")
32 stream.abort()