I had some very interesting and headache-full days trying to implement the proposed methods of three papers I've found. I decided to use PHP using \Imagick. I believe that those could be easily implemented with pure imagemagick / shell scripts. I'd like to share my results in the hope that my results and my work on this is helpful or at least interesting.
First of all. Why? ImageMagicks -auto-gamma did not satisfy me. My photos range from bright landscapes over buildings on a sunny day with lots of detail hidden in the shadows up to dark/dimmed images of the sea. I also do have pictures with little detail - like a bird in the upper-right of the photo. It's easy to guess that -auto-gamma does have trouble with some of these. Hence I was looking for something.. adaptive.
I am going to use the following (non official) abbreviations to allow to distinguishing between the three methods: agcwd / iagcwd / agcie.
A hopefully correct (and most likely not full) description of the three methods: AGCWD is an adaptive gamma correction with weighting distribution - probably known by most people because it is around for quite some years now. iagcwd is an improved version of that which (basically) tries to enhance brightness-distorted photos and tries to get around the problems that arise using agcwd. agcie is a completely different implementation which tries to minimize the negative effects of prior adaptive gamma correction methods.
Pictures are always in this order: original / agcwd / iagcwd / agcie.
I wouldn't say that any of these methods is best or worse - they do all play very good for specific photos and not so good for other photos. AGCWD looks the most pleasant to me - it does however loose detail/contrast in bright areas. You can push such a photo a lot by 1. agcwd, 2. levels, 3. unsharp mask. The third method can be improved by feeding it with a denoised-image for the transformation and by using a trim-to-detail image for classification & transformation. I also played around with averaging AGCWD & IAGCWD which lead to good results.
My implementation is available at Github: https://github.com/chani/AdaptiveGammaCorrection
More pictures / results with the full-size photos can be seen at my blog: https://jeanbruenn.info/2018/11/06/anot ... mentation/
- AGCWD: S. Huang, F. Cheng and Y. Chiu, „Efficient Contrast Enhancement Using Adaptive Gamma Correction With Weighting Distribution,“ in IEEE Transactions on Image Processing, vol. 22, no. 3, pp. 1032-1041, March 2013. doi: 10.1109/TIP.2012.2226047
- IAGCWD: Cao, Gang & Huang, Lihui & Tian, Huawei & Huang, Xianglin & Wang, Yongbin & Zhi, Ruicong. (2017). Contrast Enhancement of Brightness-Distorted Images by Improved Adaptive Gamma Correction. CAEE. 10.1016/j.compeleceng.2017.09.012.
- AGCIE: Rahman, Shanto & Rahman, Md. Mostafijur & Abdullah-Al-Wadud, M & Al-Quaderi, Golam Dastegir & Shoyaib, Mohammad. (2016). An adaptive gamma correction for image enhancement. EURASIP Journal on Image and Video Processing. 35. 10.1186/s13640-016-0138-1.
P.S: I'm just a hobbyist :^)