12/14/2011

### Histogram Examples

An intensity histogram is a graph, plotting the number of pixels (or fractional area) with a specific gray level vs. the gray level value. (Photoshop shows a histogram when adjusting the brightness, contrast and gamma:  Image / Adjust / Levels...).  The image processing exercises for NIH Image / Scion Image (no longer available) / ImageJ, include an introduction to histograms.

Histogram Type:  Normal is the usual histogram, with number of pixels (ordinate, Y-axis) plotted against the pixel value (abscissa, X-axis).  Cumulative is the cumulative number of pixels (for all values equal to or less than the current value) plotted against pixel value.

Histogram Data:  Original means the pixel data values for the image.  For 16-bit or real values, this can result in a large number of bins and take a long time to plot.  Scaled means the scaled pixel values used to make the pixmap -- these are 8-bit values ranging from 0 to 255.  Ignore zeros (see Example 3) means Lispix does not plot the number of zero valued pixels, which is useful if this is much larger than the number of any other pixel value.

### Histogram Example 1

Here are steps to display the histogram for an 8-bit gray scale image, and transfer it to Excel and display it there.

1. Open an image.
1. Use the File / Open menu and select an image, or...
2. Help / Samples & Info / Images / Koala
2. Plot the histogram:  Info / Plot histogram / Histogram Type - select normal / Histogram Data - select original
3. Print the values to a text window:  Plots / print / no (do not print an index column) / no (Do not print integers in floating point.)
4. Select all of the numbers in the text window:
1. Click inside the text window.
2. <control>-a
5. Copy the numbers:  <control c>
6. Open a new Excel worksheet.  Paste numbers into Excel:   <control v>.
7. Plot the histogram in Excel:
1. Click on column B to select it.
2. Insert / Chart / line / finish.

(cumulative histogram plot for this image)

Lispix screen showing image, histogram and values in the histogram, all selected (not all visible).

Hitogram in Excel - worksheet, columns and chart.

### Histogram Example 2

1. Open an image.
1. Use the File / Open menu and select an image, or...
2. Help / Samples & Info / Images / Koala
2. Plot the histogram:  Info / Plot histogram / Histogram Type - select cumulative / Histogram Data - select original

normal histogram plot for this image

### Histogram Example 3

Ignore Zeros

The image in the background is a processed image with a blank background - most of the black area is exactly zero.  The resulting histogram on the left has a large spike at zero intensity which results in the rest of the histogram being scaled (squished) down to zero.  The plot on the right is the histogram ignoring zeros.