Re: GM -normalize without clipping highlights

[email protected] Tue, 20 Jul 2010 10:44:30 +0000 (UTC)
Newsgroups gmane.comp.video.graphicsmagick.core
Message-ID <1870790244.139336.1279622670746.JavaMail.root@sz0023a.westchester.pa.mail.comcast.net>
It seems to me that the "-normalize" procedure ought to normalize the image,
which is a well-defined operation, namely to stretch the range of
pixel values to fill the range, done in linear colorspace:
http://en.wikipedia.org/wiki/Normalization_%28image_processing%29

Looking at the NormalizeImage method in enhance.c, it appears(*) that GM
is clipping the low one-tenth percent of the intensities, with
no option to override that behavior.  Also it seems to be up to the
user to ensure that the operation is done in the linear colorspace.

(*) I could easily be mistaken, as I am looking at this code before
6:30 in the morning... After downing a cup of coffee, it actually seems
to be using one-tenth of one percent of the number of pixels which strikes
me as really odd (I could still be mistaken...)

 /*
    Find the histogram boundaries by locating the 0.1 percent levels.
  */
  threshold_intensity=(long) (image->columns*image->rows)/1000;

In a 10 Megapixel image, threshold_intensity would be 10000, which
is pretty high even in a Q16 build and would wipe out the entire
picture in a Q8 build.

ImageMagick's Normalize method clips the bottom 2 percent and
the top 1 percent of the range, also with no override option.


Glenn

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first