Multi Part Image

<< Click to Display Table of Contents >>

Navigation:  Migration Guide for the Acquisition Stacks > CVB C# >

Multi Part Image

Multi part basically means that the stream returns a composite instead of an image which may itself consist of one or more image(s), planes of point cloud(s) etc. In other words: A composite is a way to iterate over and interpret the delivered data and it will in fact be necessary to do so in order to make sense of the acquired data.

The use of a composite element's data is represented by the composite purpose, which can be:

Custom: an unspecified custom composite - consult the source of the image for an interpretation.

Image: one image, potentially with extra data.

ImageList: multiple images grouped together.

MultiAoi: multiple images that represent multiple AOIs in one frame.

RangeMap: a 2.5D image, potentially with extra data.

PointCloud: 3D data, potentially with extra data.

ImageCube: a (hyper spectral) image cube.

The different part types are:

A standard image

A single plane of data holding, e.g for point clouds confidence data

A collection of grouped planes, e.g. R,G and B planes

A generic raw buffer

A raw buffer following Pixel Format Naming Convention (PFNC) for e.g. packed data, which is not representable as an image.

 

Code Example

3rd generation stack

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

using (var devices = DeviceFactory.Discover(DiscoverFlags.IgnoreVins))

{

  using (var device = DeviceFactory.Open(devices[0], AcquisitionStack.GenTL))

   {

      var stream = ((GenICamDevice)device).GetStream<ImageStream>(0);

      stream.Start();

      for (int i = 0; i < 10; i++)

       {

      using (var composite = stream.Wait(out WaitStatus status))

       {

          using (var nodeMaps = NodeMapDictionary.FromBuffer(composite))

           {

                  var img = MultiPartImage.FromComposite(composite);

                  foreach (var part in image.Parts)

                   {

                      switch (part)

                       {

                          case Image partImage:;

                          break;

                          case PfncBuffer buffer:

                          break;

                          default:

                          break; // and more

                       }

                   }

           }

       }

       }

      stream.Abort();

   }

}

(9) With the wait function we await a multi part image.

(14) Get the parts from the multi part image.

(18) The type of this element can be verified and handled differently.

 

Summary

As has been shown, acquiring multi part data from a camera is not actually any more complex than acquiring a composite - the actual effort with multi part data goes into parsing the content of the received composite. Usually this will be done with the properties of the hardware in mind, i.e. like in the example above, the code usually contains assumptions about the content of the composite (that should, of course, be verified) and therefore tends to be somewhat device-specific.