This example program is located in your CVB installation under %CVB%Tutorial/Image Manager/CVBpy/BufferHandling
.
flowsetpool.py:
import cvb
stream.register_managed_flow_set_pool(100)
print("Buffers allocated: {}".format(stream.flow_set_count))
stream.deregister_flow_set_pool()
stream.register_managed_flow_set_pool(200)
print("Buffers allocated: {}".format(stream.flow_set_count))
stream.start()
for i in range(10):
image, status, node_maps = stream.wait()
with image:
print("Acquired image: {}".format(i))
stream.abort()
Union[cvb.GenICamDevice, cvb.VinDevice, cvb.EmuDevice, cvb.VideoDevice, cvb.NonStreamingDevice] open(str provider, int acquisition_stack=cvb.AcquisitionStack.PreferVin)
List[cvb.DiscoveryInformation] discover_from_root(int flags=cvb.DiscoverFlags.FindAll, int time_span=300)
ringbuffer.py:
import cvb
stream = device.stream()
stream.ring_buffer.change_count(5, cvb.DeviceUpdateMode.UpdateDeviceImage)
stream.ring_buffer.lock_mode = cvb.RingBufferLockMode.On
print("Buffers allocated: {0} | Lock mode: {1}".format(stream.ring_buffer.count, stream.ring_buffer.lock_mode))
stream.start()
images = []
for _ in range(10):
image, status = stream.wait_for(5000)
if status == cvb.WaitStatus.Ok:
images.append(image)
print("Image list size: {}".format(len(images)))
elif (status == cvb.WaitStatus.Timeout and len(images) > 0):
first = images.pop(0)
first.unlock()
print("Image unlocked")
stream.abort()