cyberang3l / timelapse-deflicker

Simple script to deflicker images taken for timelapses
GNU General Public License v3.0
100 stars 18 forks source link

Use gamma correction instead of changing the brightness? #2

Open cyberang3l opened 9 years ago

cyberang3l commented 9 years ago

After some reading, as I understand the brightness changes (that I use in this script) are linear for the whole tonal range, but gamma changes are not. Since the images are gamma encoded, it makes sense to "want" to change the gamma value instead of the brightness, in order to have the "same" perceived brightness-change effect in the highlights and shadows.

This are some notes for me:

Debug gamma and other imagemagick functions on command line:
http://www.cambridgeincolour.com/tutorials/gamma-correction.htm
   convert DSC_8400.JPG -gamma 1 jpg:- | display jpg:-
   convert DSC_8400.JPG -colorspace Gray -gamma 2.2 jpg:- | display jpg:-
   convert DSC_8400.JPG -colorspace Gray -gamma 2.2 jpg:- | identify -verbose jpg:-
   convert DSC_8400.JPG -format "%[gamma]\n" info:
# my $gamma = (1 / ( $luminance{$i}{original} / $luminance{$i}{value} ));
cyberang3l commented 9 years ago

Some more notes: convert -format '%c' DSC_8400.JPG -colorspace YIQ histogram:info:- $image->Mogrify( 'modulate', brightness => $value );