Demo
The histogram demo on the following page displays a single band gray
level image, a small inset navigator window which allows the image to
be panned, a display of the color map, and a control panel containing
buttons to perform histogram related operations on the displayed image.
The button functions include reset the entire display, perform histogram
equalization, perform histogram normalization using the JAI "matchcdf"
operator, and perform a piecewise linear mapping using the JAI "piecewise"
operator.
JAI
The primary tasks needed to obtain a histogram are as follows:
1. Create a Histogram object, which specifies the type of histogram to be generated. 2. Create a Histogram operation with the required parameters or create a ParameterBlock with the parameters and pass it to the Histogram operation. 3. Read the histogram data stored in the object.
Theory
A histogram provides a view of the intensity profile of an
image and is often displayed as a bar chart. Pixel values are
partitioned and counted with the population of each partition value placed
in its own bin. The pixel intensities are plotted along the horizontal x-axis
while the number of occurrences for each intensity are plotted along
the vertical y-axis. Histograms can be viewed as probability density functions.
For a single band 8 bit image there are 256 possible intensity values. For example, the intensities range from 0 to 255, inclusively, for an unsigned byte image. Given a single band 8 bit image that is 128 by 128 with values all set to zero the resulting histogram would have a single spike at 0 with a bin count of 16384 and all other 255 bins having count 0. The sum of all bin counts in a histogram should match the number of collected samples.