Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Acquisition and Streaming - Single Stream

using namespace Cvb;
auto devices = DeviceFactory::Discover(DiscoverFlags::IgnoreVins); // (1)
auto device = DeviceFactory::Open<GenICamDevice>(devices[0].AccessToken(),
AcquisitionStack::GenTL); // (2)
auto stream = device->Stream<ImageStream>(); // default: index = 0 (3)
stream->Start(); // (4)
while(true)
{
ImagePtr image;
WaitStatus status;
std::tie(image, status, nodeMaps) = stream->Wait(); // (5)
//Process image
}
stream->Abort(); // (6)
void Start() override
static std::vector< DiscoveryInformation > Discover()
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)
WaitStatus
std::shared_ptr< Image > ImagePtr

using (var devices = DeviceFactory.Discover(DiscoverFlags.IgnoreVins)) // (1)
{
using (var device = (GenICamDevice)DeviceFactory.Open(devices[0], AcquisitionStack.GenTL)) // (2)
{
var stream = device.GetStream<ImageStream>(0); // (3)
stream.Start(); // (4)
while(true) {
WaitStatus status;
using (var image = stream.Wait(out status)) // (5)
{
//Process image
}
}
stream.Abort(); // (6)
}
}
static Device Open(DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
static DiscoveryInformationList Discover()

import cvb
devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins) # (1)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device: # (2)
stream = device.stream(cvb.ImageStream) # default: index = 0 (3)
stream.start() # (4)
while True:
image, status, node_maps = stream.wait() # (5)
# Process image
stream.abort() # (6)
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. All devices are discovered across all interfaces and transport layers except for the legacy VIN transport layers.
  2. The first discovered device is opened using the GenTL acquisition stack and internally allocated buffers.
  3. A data stream is instantiated with index zero (default; when working with devices with more than one stream, the stream index could be passed as parameter).
  4. The stream acquisition is simplified to the combined start, which advises the driver to start the acquisition engine and stream control mechanism automatically. A user does not have to call these separate streaming components separately unless they want to. By default, infinite acquisition is started. After starting the stream, the stream engine and control are running in the background until the stream is stopped, sending a continuous flow of images or composites.
  5. Each image will need to be proactively waited for by means of a call to wait on the stream. The returned tuple consists of three components: the actual image, a status code and a nodemap enumerator.
  6. The abort operation immediately stops the ongoing stream.