Camera Configuration

<< Click to Display Table of Contents >>

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

Camera Configuration

What has changed?

The procedure for configuring a camera has not changed with the presence of the new acquisition stack. However, as the memory buffer structure has been adapted to flow set pools, (re)allocating the buffers is different. This has to be considered when changing the camera configuration after streaming resp. after the buffers have been allocated.

 

Code Examples

Before Streaming

If camera settings that affect the buffers, are changed before streaming, the buffers are allocated correctly automatically be the acquisition stack. The procedure is the same for 2nd and 3rd generation stack.

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

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

{

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

   {

      var stream = device.Stream;

      var nodes = device.NodeMaps[NodeMapNames.Device];

       var pixelFormat = nodes["PixelFormat"] as EnumerationNode;

      pixelFormat.Value = "Mono10";

       stream.Start();

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

       {

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

       {

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

           {

              // do something with the composite and the node map

           }

       }

       }

      stream.Abort();

   }

}

(5) Get the required node map, on which the parameter needs to be changed.

(6) Get the node to be read or written.

(7) Set the new value. In this example the pixel format is changed and the buffers will be allocated with the new correct size automatically.

 

After Streaming

If camera settings, that affect the buffers, are changed after streaming, the buffers will need to be allocated with the new layout. As the memory structure has changed, the updating of the buffers to the new size is done differently in 3rd generation stack.

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

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

{

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

   {

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

       {

       // do a first round of image acquisition here, i.e.

       //   stream.Start()

       //   stream.Wait() n times

       //   stream.Abort()

      var nodes = device.NodeMaps[NodeMapNames.Device];

      var pixelFormat = nodes["PixelFormat"] as EnumerationNode;

      pixelFormat.Value = "Mono10";

      // deregister old flow set pool to force an update of the buffers

      stream.DeregisterFlowSetPool();

      stream.Start();

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

       {

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

           {

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

               {

                  // do something with the composite and the node map

               }

           }

       }

      stream.Abort();

       }

   }

}

(9) The camera setting "PixelFormat" is changed, which means, that the buffers will need to be resized.

(11) In the 3rd generation stack the buffers are organized in a flow set pool. To reallocate the buffers, an existing flow set pool has to be removed from the acquisition engine. Removing a flow set pool can be useful in between subsequent registrations to reduce memory consumption. Find more information on flow set pools in Ringbuffer vs Flow Set Pool.