Histogram Y Axis

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
blue-j
Posts: 68
Joined: 2007-06-12T14:03:18-07:00

Histogram Y Axis

Post by blue-j »

I just realized that histograms would make a lot more sense if the Y axis showed the percentage of pixels at a particular intensity, rather than a pixel count. I can't conceive of a counterargument at this time, though presumably a count can be useful as well. But if we defaulted to percentage, then we could easily compare histograms visually and meaningfully.

My desire is, if no one has a counterargument, to make this option available in ImageMagick, perhaps even the default...!??

- J
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Histogram Y Axis

Post by fmw42 »

Are you talking about the histogram data or the image output?

100% of what? The maximum count? I doubt it would become the default, since that would disrupt past mode of operation and potentially existing scripts.

Other changes to the histogram would be useful:

1) ability to set the output image size
2) ability to change the output image from column format to line format
3) grid lines/tick marks optional on the output image
4) list histogram textual counts by channel in increasing order of grayscale with zeros filled in, so that data can be processed separately.

I have a bash shell script that uses gnuplot to do either profiles or histograms that have most of the first 3 features. I have not scaled it to 100%, though. Feel free to try it out. See my script, plot, at my link below.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Histogram Y Axis

Post by snibgo »

Changing a default behaviour is very bad news as it would break existing scripts.

Personally, I very rarely use IM's histograms because they don't do anything useful. In particular, they don't record the histogram data as Nx1 images so we can't do any image processing with the data.

Instead, I wrote them as Process modules. Histograms can be normalised (so the maximum count is 100%), or cumulative, or both, or de-cumulated or inverted. Normalising so the total is 100% is a trivial extension: divide the Nx1 histogram image by (its mean multiplied by its size).
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: Histogram Y Axis

Post by fmw42 »

Yes, snibgo, I would agree. We need your 1D histograms as well as better output image controls.
Post Reply