Common Vision Blox 15.0
Loading...
Searching...
No Matches
Acquisition and Streaming - Resize Flow Set Pool

When starting acquisition, the CVB acquisition engine will select a default size for the flow set pool to use (i.e. how many frames can be buffered at once). In many situations, this value is not optimal for the given application and system, and it is beneficial to tweak this to get maximum performance at the lowest memory usage. CVB provides the functionality to do this with little effort by calling CVB::Driver::Stream::RegisterManagedFlowSetPool with the required number of flow sets.

using namespace Cvb;
auto devices = DeviceFactory::Discover(DiscoverFlags::IgnoreVins);
auto device = DeviceFactory::Open<GenICamDevice>(discoveryInfo[0].AccessToken(), AcquisitionStack::GenTL);
auto stream = device->Stream<ImageStream>(); // (1)
stream->RegisterManagedFlowSetPool(100); // (2)
stream->DeregisterFlowSetPool(); // (3)
stream->RegisterManagedFlowSetPool(200); // (4)
stream->Start();
void RegisterManagedFlowSetPool(int flowSetCount)
static std::vector< DiscoveryInformation > Discover()
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)

using (var devices = DeviceFactory.Discover(DiscoverFlags.IgnoreVins))
{
using (var device = (GenICamDevice)DeviceFactory.Open(devices[0], AcquisitionStack.GenTL))
{
var stream = device.GetStream<ImageStream>(0); // (1)
stream.RegisterManagedFlowSetPool(100); // (2)
stream.DeregisterFlowSetPool(); // (3)
stream.RegisterManagedFlowSetPool(200); // (4)
stream.Start();
}
}
static Device Open(DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
static DiscoveryInformationList Discover()
void RegisterManagedFlowSetPool(int numFlowSets)

import cvb
devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device:
stream = device.stream(cvb.ImageStream) # (1)
stream.RegisterManagedFlowSetPool(100) # (2)
stream.DeregisterFlowSetPool() # (3)
stream.RegisterManagedFlowSetPool(200) # (4)
stream.start()
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)

Note: Error handling has been omitted from the above example.

  1. Instantiate the stream as normal
  2. Update the number of flow sets by calling CVB::Driver::Stream::RegisterManagedFlowSetPool.
  3. When calling CVB::Driver::Stream::RegisterManagedFlowSetPool multiple times, it is recommended to call CVB::Stream::DeregisterFlowSetPool between. Internally, CVB will allocate the new Cvb::FlowSetPool and then delete the old one, which will lead to spikes in the memory usage as both the old and new Cvb::FlowSetPools are instantiated for a brief moment, which may lead to issues on memory-limited systems.
  4. Update the number of flow sets again by calling CVB::Driver::Stream::RegisterManagedFlowSetPool. New calls to CVB::Driver::Stream::RegisterManagedFlowSetPool will override previous calls.