Hi!
First I'd like to say about ImageMagick: brilliant work! It helped me a lot in many cases.
Right now I'm doing a project, which goal is to remove dynamic objects from the image sequence. Actually I've got a problem with "normalizing" image stack (shots can be taken from hand, may have slightly different perspective and different light conditions). Is it possible to calculate the average lightness/grey_value of images in a stack and set the correct mean value to each image using ImageMagick? I can see there's -evaluate-sequence parameter, but each interesting option is converting image stack to a single output image. I need something like: "command -average-lightness -outprefix out image1 image2 image3..." and as a result "outimage1 outimage2 ..." with normalized/averaged light balance.
Example: http://techblog.zabuchy.net/2011/automa ... al-images/
Thanks a lot,
kotu
Average value of hue/saturation/lightness/grey_value(?)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Average value of hue/saturation/lightness/grey_value(?)
try either -auto-level or contrast-stretch XX% (or even -auto-gamma) (if XX=0, stretches but does not clip, if XX>0, it stretch to clip values determined by percent pixel counts from the ends of the histogram)
mogrify ... -auto-level ...
see
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/script/comma ... auto-level
http://www.imagemagick.org/script/comma ... st-stretch
http://www.imagemagick.org/script/comma ... auto-gamma
mogrify ... -auto-level ...
see
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/script/comma ... auto-level
http://www.imagemagick.org/script/comma ... st-stretch
http://www.imagemagick.org/script/comma ... auto-gamma
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Average value of hue/saturation/lightness/grey_value(?)
The averge 'Hue' of an image can be problematical when you have colors going from yellowish-red to purplish-red.
You are then trying to average 'near colors' that have either near-maximum and near-minimum hue values!
The problem is Hue is actually an Angle which has a 'modulus' or 'cyclic' value. I came up against this very problem in in trying to generate a DIY hue gradient between points of color...
DIY Gradients and Hues
http://www.imagemagick.org/Usage/canvas ... mplex_hues
The solution to getting a average Hue, ended up to be simply the Hue of the images average color in a linear RGB (sRGB in IMv6 weird colorspace mapping definitions). You can also do this in LAB space too!
You are then trying to average 'near colors' that have either near-maximum and near-minimum hue values!
The problem is Hue is actually an Angle which has a 'modulus' or 'cyclic' value. I came up against this very problem in in trying to generate a DIY hue gradient between points of color...
DIY Gradients and Hues
http://www.imagemagick.org/Usage/canvas ... mplex_hues
The solution to getting a average Hue, ended up to be simply the Hue of the images average color in a linear RGB (sRGB in IMv6 weird colorspace mapping definitions). You can also do this in LAB space too!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/