Last Revision Date: 11/3/2017
This article explains how to perform falloff correction on an image by using the correction factor values obtained from the ladybugGetFalloffCalibration() function in the ladybug libary. This article is applicable to Ladybug5+, Ladybug5, Ladybug3, and Ladybug2.
The Ladybug library has functionality to perform falloff correction on images, however in some situations a user may want to implement falloff correction themselves. One possible reason is performance increase which could be gained from performing falloff correction in CUDA.
How to get correction factor values
Correction factor values are calculated based on the image size, gamma value, and attenuation. If any of these values change, new values must be generated.
The correction factor values can be obtained from the API by using the ladybugGetFalloffCalibration() function. The values will be in the form of an array of pointers, with the nth element of the mth pointer being the correction factor for the nth pixel of the mth image.
How to perform falloff correction
Falloff correction can be performed by multiplying each RGB subpixel by a multiplier value. When performing falloff correction it is important to avoid saturating any channel. The multiplier for each pixel can be calculated using the following equation:
MaxWithoutSaturation = 255 / ( Max (Blue value, Green value, Red value) )
CorrectionFactor is the value obtained from the API
Multiplier = Min (MaxWithoutSaturation, correctionFactor)
This equation ensures that if the correction factor is too large and will cause saturation, the multiplier will be reduced to the largest possible value that will not cause saturation.