- Attention
- Reinterpreting Images as PFNC Buffers is not supported in the Python API.
By default, the CVB acquisition attempts to process the received data as an Image or Point Cloud as specified by the stream type. If this is not possible (e.g. due to unsupported/invalid data formats), no Cvb::Image
or Cvb::PointCloud
will be returned. To access this data, the underlying buffer can be read and parsed instead using a Cvb::CompositeStream
.
while(true)
{
std::tie(composite, status, nodeMaps) = stream->Wait();
auto handle =
Cvb::visit([](
auto&& element) {
return element->Handle(); }, cvb_composite->ItemAt(0));
}
stream->Abort();
static std::vector< DiscoveryInformation > Discover()
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)
static PFNCBufferPtr FromHandle(HandleGuard< BufferBase > &&guard)
auto visit(VISITOR &&visitor, VARIANT &&var) -> decltype(visitor(get< 0 >(var)))
std::shared_ptr< Composite > CompositePtr
{
{
while(true) {
using (var composite = stream.Wait(out status))
{
var handle = composite[0].Handle();
var buffer = PFNCBuffer.FromHandle(handle,
ShareObject.No)
}
}
stream.Abort();
}
}
static Device Open(DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
static DiscoveryInformationList Discover()
cvbbool_t ShareObject(OBJ Object)
Note: Error handling has been omitted from the above example.
- The device and stream is opened per normal. It is recommended to use a
Cvb::CompositeStream
but any stream type can be accessed as a buffer.
- The composite is read from the stream in the same manner as a normal image.
- The handle to the underlying object is retrieved.
- A
Cvb::PFNCBuffer
view is created on the underlying object, allowing the data to be read out from it.