When receiving a composite from a camera, its content may not be immediately known. Therefore, you should analyze the composite first:
(1) The composite's purpose is checked. When working with 3D area scan cameras, it should be cvb.CompositePurpose.PointCloud
.
(2) All composite items are iterated over in a loop and retrieved.
(3) The item's type is displayed, which can be either cvb.PlaneEnumerator
, cvb.Plane
, cvb.Image
, cvb.PFNCBuffer
or None
.
If you only need access to the X, Y, Z, and optional confidence values, you can convert the composite into a point cloud for simplified data access. For all other cases, use the generic composite access described in Generic Access to Composite.
If you only need access to the X, Y, Z, and optional confidence values, you can simply convert the cvb.Composite
into a cvb.PointCloud
:
If, after analyzing your composite, you find that it contains additional data beyond what was covered in the previous section, you need to access it in a more generic way. This can be done retrieving the items of a composite and mapping them to a NumPy array:
(1) Retrieve the item. To convert it into a NumPy array, it must be either a cvb.PointCloud
, cvb.Plane
, cvb.Image
, or cvb.PFNCBuffer
.
(2) The item is mapped to a NumPy array without copying, allowing direct access to pixel data.
(3) Check whether the mapping was successful; if OWNDATA
is True
, the item could not be mapped. In this case, the item has to be copied by setting copy=True
in previous call
If your data has a specific type, refer to the more detailed sections:
Point Cloud Stream
Composite Stream
Image Pixel Access in Python