Re: GM -normalize without clipping highlights
[email protected] Tue, 20 Jul 2010 13:15:17 +0000 (UTC)
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <1646132714.146463.1279631717305.JavaMail.root@sz0023a.westchester.pa.mail.comcast.net> |
I *was* mistaken, confused by the variable names used in enhance.c. "threshold_intensity" contains a number of pixels to be ignored at the top and bottom of the histogram and not an intensity. So we are ignoring the top and bottom 0.1% of the intensities present in each channel when calculating the contrast range. ImageMagick ignores the top 1% and bottom 2%, and uses equally confusing names for these numbers of pixels (black_point and white_point). Glenn ----- Original Message ----- From: [email protected] To: "Development of the GraphicsMagick core" <[email protected]> Sent: Tuesday, July 20, 2010 6:44:30 AM Subject: Re: [GM-core] GM -normalize without clipping highlights 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 _______________________________________________ Graphicsmagick-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-core ------------------------------------------------------------------------------ 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