3 Implementations for Adaptive Gamma Correction

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 3 Implementations for Adaptive Gamma Correction

Post by fmw42 »

Your evaluate pow is the same as -auto-gamma except you use 0.3 and auto-gamma is limited to 0.5. It was my intention that -auto-gamma be modified to have a -define to allow that value (0.5) to be modified. My autogamma script is like your use of evaluate pow. It allows the value to be set as desired.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 3 Implementations for Adaptive Gamma Correction

Post by fmw42 »

snibgo wrote:%IM7DEV%magick ^
%SRC% ^
+write mpr:INP ^
-process 'mkhisto verbose' ^
-auto-level ^
-evaluate Pow %alpha% ^
-process 'cumulhisto norm verbose' ^
-negate ^
-evaluate Divide %%[fx:QuantumRange] ^
( +clone ^
-sparse-color bilinear 0,0,Black,%%[fx:w-1],0,White ^
) ^
-evaluate-sequence Pow ^
mpr:INP ^
+swap ^
-clut ^
out3.png
Did you really mean -sparse-color bilinear and not -sparse-color barycentric? The bilinear option requires 4 points and you only have two.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: 3 Implementations for Adaptive Gamma Correction

Post by snibgo »

"-sparse-color bilinear" with only two points gives a linear gradient. See http://www.imagemagick.org/script/comma ... arse-color
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 3 Implementations for Adaptive Gamma Correction

Post by fmw42 »

That page says
bilinear
Like barycentric but for 4 points. Less than 4 points fall back to barycentric.
So if two points it would be the same as using barycentric.

The reason I asked was that I kept getting an error in number of argument for -sparse-color bilinear when I only had two points.
Post Reply