Sensor API v2.5.0
Data Acquisition

This page describes how to use callback functions to receive data from the sensor.

Line callback

The recommended way to acquire 3D data is to use line callback configuration (_SetLineCallback). Benefits of this mode are that it provides 3D points with a fixed x-size and it has many preprocessing options available. All preprocessing functions provided by the line callback are available also in batch callback.

If a line callback is configured following preprocessing functions are available:

Application shall call _SetLineCallback separately for each layer. The configuration specifies how many layers are expected. For example, if a user wants to have callback for 3 top layers following functions shall be called:

_SetLineCallback(camera_ids[0], 0, LineCallbackHandler);
_SetLineCallback(camera_ids[0], 1, LineCallbackHandler);
_SetLineCallback(camera_ids[0], 2, LineCallbackHandler);

Batch callback

The batch callback option (_SetBatchCallback) can be used if the application does not need to process the profile data when acquired. SDK's batch functionally collects profiles until number of profiles (PARAM_BATCH_LENGTH) is reached. It is also possible to define a timeout for the callback (PARAM_BATCH_TIMEOUT).

status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], const_cast<char*>(PARAM_PEAK_ENABLE), 1));
status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], const_cast<char*>(PARAM_BATCH_LENGTH), 1000));
status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], const_cast<char*>(PARAM_BATCH_TIMEOUT), 5000));
status = static_cast<CameraStatus>(_SetBatchCallback(camera_ids[0], 0, BatchCallbackHandler));
status = static_cast<CameraStatus>(_StartGrabbing(camera_ids[0]));

Recommendations for buffering by using encoder position

When the line callback is used the application typically collects the data to fixed size batches. Below are recommendations listed for the application software.

  1. Preallocate a buffer for the batch. Usually application knows how many profiles are needed.
  2. When a profile is received copy it to the proper buffer location.
  3. When the last line is received the buffer is ready and in order
batch_buffering.png

For continuous inspections it is recommended to use double buffering. One is used for profile acquisition and other for processing.

Raw image callback

The raw image callback can be used when the gray scale image for the camera is needed. Note that the imaging frequency shall be low enough to fit data to the Ethernet.

status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], PARAM_PEAK_ENABLE, 0));
status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], PARAM_REG_PULSE_FREQ, 50));
status = static_cast<CameraStatus>(_SetRawImageCallback(camera_ids[0], RawImageCallbackHandler));
status = static_cast<CameraStatus>(_StartGrabbing(camera_ids[0]));

Profile callback

The profile callback can be used if the application needs all points from the sensor without preprocessing.

Point cloud provided by Profile callback contains all detected peaks up to defined limit (PARAM_MAX_POINT_COUNT)

status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], PARAM_PEAK_ENABLE, 1));
status = static_cast<CameraStatus>(_SetIntParameter(camera_ids[0], PARAM_REG_PULSE_FREQ, SENSOR_FREQUENCY));
status = static_cast<CameraStatus>(_SetProfileCallback(camera_ids[0], ProfileCallbackHandler));
status = static_cast<CameraStatus>(_StartGrabbing(camera_ids[0]));

See FSDSK source file ConsoleExample.cpp basic callback function implementation ProfileCallback.

Thickness calculation

Effective refractive index correction and thickness calculation can be enabled for the profiles given by the lineCallback and batchCallback functions. This is useful for transparent layers where layer thicknesses are needed to be analyzed.

End user needs to configure effective refractive index for each layer separately with _SetLayerFloatParameter() function. This calibration can be done by measuring known layer and calculating ratio of real thickness and measured thickness. This will adjust z-coordinates of layers in the world coordinate system.

_SetLayerFloatParameter(camera_ids[0],0, PARAM_LAYER_EFFECTIVE_REFRACTIVE_INDEX, 1.333)); // Refractive index for the first layer
_SetLayerFloatParameter(camera_ids[0],1, PARAM_LAYER_EFFECTIVE_REFRACTIVE_INDEX, 1.21)); // The second layer
_SetLayerFloatParameter(camera_ids[0],2, PARAM_LAYER_EFFECTIVE_REFRACTIVE_INDEX, 1.30)); // The third layer

Additionally a user can set PARAM_THICKNESS_MODE to enable thickness calculation. In this mode the first layer contains a top surface as world coordinate points, and following layers are precalculated thicknesses in micrometers.

Z-coordinates when Thickness mode is disabled:

ThicknessMode0.png

Z-coordinates when Thickness mode is enabled:

ThicknessMode1.png