![]() |
SK91USB3-LX
1.2.0
|
Explains how to control the camera gain / offset. More...
Functions | |
int | SK_SETGAINCOUPLING (int CamID, bool enable) |
Coupling of gain channels. More... | |
int | SK_SETGAIN (int CamID, int gain, int channel) |
Gain control. More... | |
int | SK_SETOFFSET (int CamID, int offset, int channel) |
Offset control. More... | |
int | SK_GETGAIN (int CamID, int channel) |
Returns the current gain value of a ADC channel. More... | |
int | SK_GETOFFSET (int CamID, int channel) |
Returns the current offset value (black level) for the defined ADC channel. More... | |
int | SK_GETNROFCHANNELS (int CamID) |
Returns the camera specific number of ADC channels. More... | |
Explains how to control the camera gain / offset.
The number of channels for gain and offset is sensor specific and depends on the number of ADCs inside of the camera. The number of channels is returned by the function SK_GETNROFCHANNELS. The setting range for gain is 0 to 1023 (0 db to 24 db), the offset setting range is 0 to 255.
Note: Too low gain values (< 80) can reduce the signal dynamic by limiting the input range of the ADC. Very high gain values increase the noise.
Normally, to re-adjust the gain / offset setting use the SKLineScan program with the manual for SKLineScan.
If this is not possible, here is an example to display the oscilloscope signal with the library OpenCV:
1. Offset (using the SK2048U3PD)
The zero baselines of the video signal 1 and 2 must be adjusted and balanced. To do this, totally block the incident light and execute the function SK_SETOFFSET(m_CamID, 0, 0) and SK_SETOFFSET(m_CamID, 1, 0).
Minimize any differences using the function SK_SETOFFSET.
A slight signal noise should be visible in the zero baseline.
2. Gain (using SK2048U3PD)
Illuminate the sensor with a slight over exposure to identify the maximum clipping. Use the function SK_SETGAIN(m_CamID, 0, XX) (XX = gain value) to adjust the maximum output voltage for the first channel. Adjust the signal intensity with the function SK_SETGAIN(m_CamID, 1, XX) (XX = gain value) to minimize the difference between channels 0 and 1.
Notes for gain adjustment:
int SK_GETGAIN | ( | int | CamID, |
int | channel | ||
) |
Returns the current gain value of a ADC channel.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
channel | ADC channel |
int SK_GETNROFCHANNELS | ( | int | CamID | ) |
Returns the camera specific number of ADC channels.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
int SK_GETOFFSET | ( | int | CamID, |
int | channel | ||
) |
Returns the current offset value (black level) for the defined ADC channel.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
channel | ADC channel |
int SK_SETGAIN | ( | int | CamID, |
int | gain, | ||
int | channel | ||
) |
Gain control.
This function sets the gain value for the defined ADC channel.
The number of ADC channels is camera specific and can be inquire by SK_GETNROFCHANNELS or the camera manual.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
gain | gain value |
channel | ADC Channel |
int SK_SETGAINCOUPLING | ( | int | CamID, |
bool | enable | ||
) |
Coupling of gain channels.
This function is suitable for cameras with more than one ADC channel. Once adjusted, all gain channels can be coupled and will be controlled together by channel 0 only. The differences between the channels before coupling are changed proportionally.
enable
= false this function is usable for a very fast changes of gain adjustment. While Continuous Grabbing all parameter settings are blocked normally. A backdoor for gain setting between two frames is SK_SETCOMMAND(CamID, "Gnnnn", nullptr, 1), wherein all gain channels should be coupled.Calculation of proportional changing of gain channel differences inside the camera: before coupling: gain channel 0: G0= 108, gain channel 1: G1= 110
new gain G' with coupled channels
camera revision < 1.22: G0'= 212, G1'= G0' + (G1 - G0) = 214
camera revision >= 1.22: G0'= 212, G1'= G0' * G1/G0 = 216
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
enable | true = gain coupling is active false = gain coupling is not active |
int SK_SETOFFSET | ( | int | CamID, |
int | offset, | ||
int | channel | ||
) |
Offset control.
This function sets the offset value for the defined ADC channel.
The number of ADC channels is camera specific and can be inquire by SK_GETNROFCHANNELS or the camera manual.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
offset | Offset value |
channel | ADC channel |