Use min() and max() with (:) to compute the min and max and mean of the whole image:
Lmin = min(L(:));
Similar for max() and mean(). Then use the formula he gave you to compute FL
FL = ( (L-Lmin) ./ (Lmax-Lmin) ) .^ gamma;
Then compute the mean of this output image and to get the same mean as the input image you need to divide FL by the mean of the output image and multiply by the mean of the input image.
You should be able to do it now that I showed you the (:) trick. Try it.
Best Answer