MATLAB: Perform a program that automatically adjusts the average brightness of the image according to the following transformation characteristics:

automatically adjustsImage Processing Toolboxthe average brightness of the image

Perform a program that automatically adjusts the average brightness of the image according to the following transformation characteristics:
The resulting image must have a constant average brightness, the average brightness calculated according to the following formula:
please help me !!

Best Answer

Try this
LMin = min(grayImage(:));
LMax = max(grayImage(:));
outputImage = ((grayImage-LMin)/(Lmax-LMin)) .^ gamma;
K = sum(outputImage(:));
You have to supply grayImage, perhaps from using imread() or some other way, and gamma, which is typically in the range 1 to 2.4.
Related Question