The VisionCam LM2 uses the quad color line sensor GPixel GL7004:
Sensor name | Type | eFG_CAMERA_TYPE | Number of pixels | Pixel size |
---|---|---|---|---|
GL7004 | 4-line RGBW | FG_CAMERA_TYPE_4096_4_IMAGO_GL7004 | 4x 4096 | 7 µm x 7 µm |
The following image shows the functional bocks and pipeline stages:
The supported pixel formats and maximum scan rates are listed below:
eFG_PIXEL_TYPE | Active sensor lines | Output format |
---|---|---|
FG_PIXEL_TYPE_Y_8 | W | 1 byte per pixel (8 bit) |
FG_PIXEL_TYPE_RGB_24 | R, G, B | 3 bytes per pixel (8 bit R/G/B) |
FG_PIXEL_TYPE_RGBX_32 | R, G, B, W | 4 bytes per pixel (8 bit R/G/B/W) |
Use the calculator to obtain the maximum line rate:
The sensor supports the following special features:
Property name | Argument | Description |
---|---|---|
LineRate | 0: Use the maximum line rate (default) ≥ 1: Desired line rate in Hertz | Sets the desired sensor line rate for free-run mode in Hertz. The actual line rate may be limited by:
Use FG_get_special_option() in free-run mode to obtain the actual value. |
ScanPeriod | 0: Use maximum line rate ≥ 1: Desired line period in µs | Sets the desired sensor line period in microseconds, similar to LineRate. |
Mirror | 0: no flipping (default) 1: flip horizontally | Flips the image horizontally |
BinningH | 1: no pixel binning (default) 2: x2 pixel binning (sum of two neighbour pixels divided by two) 4: x4 pixel binning (sum of four neighbour pixels divided by four) | Horizontal binning mode
|
BinningV | 1: no pixel binning (default) 2: x2 pixel binning (sum of two neighbour pixels divided by two) | Vertical binning mode
|
LineDelay | -200...200: readout delay in percent of one line | Sets the readout delay between two neighbouring sensor lines (color pixel formats). This setting compensates the physical displacement of the different sensor lines depending on the transport direction and speed. The value is given in percent of one line. The default value is 200 (percent) which represents the physical separation of two neighbouring sensor lines. This is the correct value for square pixel projection (relation of object speed and line rate).
|
AnalogGain | 1...4: gain value | Analog gain. |
OffsetCorrection | 0: off 1: on (default) | Controls the automatic offset correction. The offset correction is based on dedicated black sensor pixels for each sensor line.
|
ImageMode | 0: Video output 1: Test image: horizontal ramp 2: Test image: horizontal ramp with increasing start value | Controls the image mode |
Additional features are described in the following sections:
Multiple sensor lines are recorded and concatenated to complete an image with the specified image height.
Selecting a smaller image height reduces software latency, because all image lines have to be in memory before the buffer is given to the user. But this will also increase the processing overhead.
With FG_set_aoi(), the x coordinates specify the sensor columns for readout. The parameter y1
has to be zero and y2
+ 1 specifies the number of lines to acquire for each image. The default image height is 512 after initialization.
Example:
The alternative function FG_set_scan_param() can also be used to specify the AOI width and number of scans per image (parameter image_scan_count
). The parameter scan_height
must be set to one and image_scan_count
is equal to the desired image height.
Example:
The following example configures an AOI width of 1024 at the sensor's center location:
In hardware triggered mode, each trigger event starts exposure for active color channels (depending on the selected pixel format). The exposure time is controlled by FG_set_shutter_time().
The RTCC can be used to adapt the the trigger signal to the desired scan rate, see section Hardware trigger for examples.
Depending on the configured image height, multiple trigger events are required before the image is completed and returned to the user (see Image size and sensor AOI).
An additional frame trigger can be used to start acquisition of an image with the configured height. The trigger can be software based or hardware based using a VIB::Multiplexer signal.
Line trigger events are ignored as long as the frame is not active. Additional frame trigger events during an active frame are ignored.
A frame start delay can be configured to ignore a certain number of line trigger events after the frame trigger occured. The frame start delay period and the acquisition of the previous frame may overlap, but the previous frame must be completed before the delay expires.
The frame trigger is configured by using the following special features:
Property name | Description |
---|---|
FrameTriggerMode | Sets the frame trigger mode. 0: Don't use a frame trigger, images are captured continuously (default) 1: Frames are software triggered by using the special option FrameTrigger 100...115: Use VIB::Multiplexer output line 0...15 with rising edge 200...215: Use VIB::Multiplexer output line 0...15 with falling edge |
FrameTriggerDelay | Frame start delay after receiving the frame trigger. The number determines how many line trigger events are ignored after a frame trigger event. 0...65535 (default: 0) |
FrameTrigger | Triggers a frame in software controlled frame trigger mode (write only). Only the value 0 is valid. |
Example:
Analog Gain is configured with FG_set_special_option() and the property AnalogGain. Valid values are 1, 2, 3 and 4 corresponding to analog gain x1 ... x4.
Digital gain can be specified for the different sensor lines / colors. The functions FG_set_gain() and FG_set_gain_rgb() control the channel gain as follows:
Both functions accept a value in the range 0...1023 which corresponds to a gain value of x0 ... ~x4. The value for unity gain is 256 (default setting).
The processing pipeline provides independent offset and gain coefficients for each sensor pixel. This can be used to compensate the following problems:
Shading correction is processed by the FPGA as follows:
The gain and offset coefficients have to be calculated by the application. The calculated coefficients can then be stored into flash for later re-use.
The coefficients are configured by using FG_set_special_option() with options OffsetCoeff and GainCoeff:
Property name | Argument | Description |
---|---|---|
OffsetCoeff | Pointer to an array of unsigned char values. | Sets the offset coefficients for each active sensor pixel (see below). The values are in the range 0...255 and are applied to 10-bit values. If argument is NULL, the offset coefficients are reset to 0 for each pixel. |
GainCoeff | Pointer to an array of unsigned short values. | Sets the gain coefficients for each active sensor pixel (see below). The values are in the range 0...1023, 256 is the nominal gain value. If argument is NULL, the gain coefficients are reset to 256 for each pixel. |
SaveShadingCoeff | 0...3: setting index | Stores the current gain and offset coefficients in flash memory for later re-use. Up to four settings can be stored. |
LoadShadingCoeff | 0...3: setting index | Loads the offset and gain coefficients from flash memory. |
The argument for OffsetCoeff and GainCoeff is a pointer to an array of values containing the offset or gain coefficients for each active sensor pixel. The length and arrangement of the array depends on the pixel format and AOI width used:
eFG_PIXEL_TYPE | Number of values | Argument |
---|---|---|
FG_PIXEL_TYPE_Y_8 | AOI width | One value for each pixel |
FG_PIXEL_TYPE_RGB_24 | 3x AOI width | R/G/B components for each pixel |
FG_PIXEL_TYPE_RGBX_32 | 4x AOI width | R/G/B/W components for each pixel |
First, a reference image for calculation of the optimum gain values is required:
The example function below takes one acquired reference image to calculate the gain values for each sensor pixel. The calculation of gain values for this example is based on the average values calculated for each sensor pixel (column and color). The sensor pixel with the highest average value receives a gain of 1.0. This results in a gain ≥ 1.0 for all pixels. The function will limit gain values to the maximum allowed value of 1023. This is the case for regions which are too dark to compensate. int CalcShadingGain( FG_IMAGE *pFgImage, // pointer to reference image for calculating the shading coefficients
bool save = false) // store coefficients permanently
{
unsigned int width, height, bytes;
unsigned int channels;
// get the image size:
FG_get_image_size(&width, &height, &bytes);
// number of used color channels:
channels = bytes / (width * height);
std::vector<unsigned short> gainCoeff(channels * width, 256); // Resulting array of gain coefficients, default: 256 (x1)
std::vector<unsigned int> colSum(channels * width, 0); // Sum for each column
std::vector<double> colAvg(channels * width); // Average value for each column
double maxVal = 0.0; // Highest average value
// Calculate pixel sum for each column and channel
for (unsigned int y = 0; y < height; y++)
{
for (unsigned int x = 0; x < width; x++)
{
for (unsigned int color=0; color < channels; color++)
{
colSum[x * channels + color] += pFgImage->pixel_ptr[(x + y * width) * channels + color];
}
}
}
// Calculate average pixel value and store the highest average for all pixels
for (unsigned int x = 0; x < (channels*width); x++)
{
colAvg[x] = (double)colSum[x] / (double)height;
if (colAvg[x] > maxVal)
maxVal = colAvg[x];
}
// Calculate gain coefficients for each pixels.
// The pixel with the highest average gets a gain of 1.0.
// The gain for darker pixels is increased to reach the same brightness level.
for (unsigned int x = 0; x < (channels*width); x++)
{
if (colAvg[x] > 0.0)
{
unsigned int coeff = lroundf(256.0f * maxVal / colAvg[x]);
if (coeff > 1023) // limit gain value to ~ x4
coeff = 1023;
gainCoeff[x] = coeff;
}
}
// Set coefficients
FG_set_special_option("GainCoeff", (INT64)&gainCoeff[0]);
// Save the new coefficients permanently
if (save)
FG_set_special_option("SaveShadingCoeff", 0);
return 0;
}
|
A lookup table maps the 10-bit sensor values to 8-bit output values. For example, a gamma compression curve can be used to provide higher sensitivity for darker pixels and lower sensitivity for brighter pixels.
The lookup table is configured by using FG_set_special_option() with the option LUT. The argument is a pointer to an array of 1024 output values.
Property name | Argument | Description |
---|---|---|
LUT | Pointer to an array of 1024 unsigned char values | Sets the Lookup Table used for mapping the 10-bit pixels to 8-bit output. 8-bit values must be provided for input values in the range 0...1023. If the argument is NULL, the Lookup Table is reset to linear mapping. |
SaveLUT | 0...3: setting index | Stores the current Lookup Table into flash memory for later re-use. Up to four settings can be stored. |
LoadLUT | 0...3: setting index | Loads the Lookup Table from flash memory. |
The default linear mapping is the same as the following example: