pylon Automatically Corrects Float Values#
When you try to set a float value which is not matching the increment setting of the parameter, pylon won't give you an error message, but will automatically correct to the nearest possible value.
This applies to the Basler pylon Viewer and the API.
For example, the a2A3840-45ucPRO has an exposure time increment of 9 µs.
If you set it to 16 µs you won't get an error message, but the actual exposure time will be 12 µs.
Why will the autocorrection select 12 µs instead of 18 µs?
- The minimum exposure time of this specific camera is 12 µs.
- The increment being 9 µs, the next possible value is 21 µs.
- The target being 16 µs, there is a 5 µs difference with 21 µs, but only 4 µs to 12 µs. The nearest neighbor algorithm does then select 12 µs as the exposure time.
The example shown with API commands:
double val = 16;
Console.WriteLine(" trying to set value " + val);
camera.Parameters[PLCamera.ExposureTime].SetValue(val);
Console.WriteLine(" current increment " +
camera.Parameters[PLCamera.ExposureTime].GetIncrement());
Console.WriteLine("Current Exposure time is : " +
camera.Parameters[PLCamera.ExposureTime].GetValue());
With a target exposure value of 30 µs, there is no issue because this is an accepted value (12 + 2 x 9 = 30 µs)