Camera Configuration

<< Click to Display Table of Contents >>

Navigation:  Migration Guide for the Acquisition Stacks > CVB++ >

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 buffer layout, are changed before streaming, the buffers are automatically allocated correctly. The procedure is the same for 2nd and 3rd generation stack.

2nd generation stack

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

auto devices = Factory::Discover(DiscoverFlags::IgnoreVins);

auto device = DeviceFactory::Open(devices[0].AccessToken(),

 AcquisitionStack::Vin);

auto stream = device->Stream();

auto nodes = device->NodeMap(CVB_LIT("Device"));

auto pixelFormat = nodes->Node<EnumerationNode>(CVB_LIT("PixelFormat"));

pixelFormat->SetValue(CVB_LIT("Mono10"));

stream->Start();

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

{

auto result = stream->Wait();

if (result.Status == WaitStatus::Ok)

 {}

}

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 correct size automatically.

 

3rd generation stack

1

2

3

4

5

6

7

8

9

10

11

12

13

auto devices = DeviceFactory::Discover(DiscoverFlags::IgnoreVins);

auto device = DeviceFactory::Open<GenICamDevice>(devices[0].AccessToken()

 , AcquisitionStack::GenTL);;

auto stream = device->Stream<ImageStream>();

auto nodes = device->NodeMap(CVB_LIT("Device"));

auto pixelFormat = nodes->Node<EnumerationNode>(CVB_LIT("PixelFormat"));

pixelFormat->SetValue(CVB_LIT("Mono10"));

stream->Start();

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

{

auto [image, result, nodeMaps] = stream->Wait();

}

stream->Abort();

 

After Streaming

If camera settings, that affect the buffers, are changed after streaming, the buffers have to be re-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.

2nd generation stack

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

auto devices = Factory::Discover(DiscoverFlags::IgnoreVins);

auto device = DeviceFactory::Open(devices[0].AccessToken(),

 AcquisitionStack::Vin);

auto stream = device->Stream();

// do some acquisition here, i.e.

//   stream->Start();

//   stream->Wait(); n times

//   stream->Abort();

auto nodes = device->NodeMap(CVB_LIT("Device"));

auto pixelFormat = nodes->Node<EnumerationNode>(CVB_LIT("PixelFormat"));

pixelFormat->SetValue(CVB_LIT("Mono10"));

device->ImageRect()->Update(DeviceUpdateMode::UpdateDeviceImage);

stream->Start();

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

{

auto result = WaitStatus::Ok;

auto image = stream->Wait(result);

}

stream->Abort();

(11) The camera setting pixel format is changed, which means, that the buffers will need to be resized.

(12) This update function call resizes the buffers. The result of this operation is that the currently active device image is moved to the new device image internally. As a side effect, the current image buffer is lost and replaced by an empty buffer.

 

3rd generation stack

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

auto devices = DeviceFactory::Discover(DiscoverFlags::IgnoreVins);

auto device = DeviceFactory::Open<GenICamDevice>(discoveryInfo[0].AccessToken()

 , AcquisitionStack::GenTL);

auto stream = device->Stream<ImageStream>();

// do some acquisition here, i.e.

//   stream->Start();

//   stream->Wait(); n times

//   stream->Abort();

auto nodes = device->NodeMap(CVB_LIT("Device"));

auto pixelFormat = nodes->Node<EnumerationNode>(CVB_LIT("PixelFormat"));

pixelFormat->SetValue(CVB_LIT("Mono10"));

stream->DeregisterFlowSetPool();

stream->Start();

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

{

auto [image, result, nodeMaps] = stream->Wait();

}

stream->Abort();

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

(12) In the 3rd generation stack the buffers are organized in a flow set pool. To reallocate the buffers, the existing flow set pool has to be removed from the acquisition engine. Find more information on flow set pools in Ringbuffer vs Flow Set Pool.