int im_litecor(in, white, out, clip, factor)
IMAGE *in, *out;
The flag clip can take two values 0 and 1. If clip is 1 then the input is corrected with reference to the maximum value of white (maxw) as follows.
pel_out = factor * pel_in * maxw / pel_white.
If clip is 0 then the output is scaled with the maximum possible output set to 255. In this case factor is not used but it must be set to a dummy value.
The basic reason for lighting correction is that the input frame does not have a uniform distribution of white light due to the optical response of the lens. The function accepts a white image which is a simple multiple of the input image in size; for example it is possible that the white is a subsampled version of in; however the sizes of in must be an exact multiple of the white. If clip is set to 0, lighting correction is carried out and the result is scaled between 0 and 255. This can be used to correct individual frames.
If multiband images are grabbed, then flag should be set to 1, since no scaling must be done. In this case the factor can reduce the number of clipped pels if overshooting occurs in the brightest band. The program prints the number of clipped pels with im_warning(3).