0% found this document useful (0 votes)
64 views

Histogram Tool

The document discusses how to use histograms to analyze images and understand intensity distributions. Histograms show the distribution of intensity values in an image and can help determine if an image needs processing to improve contrast or has been over-processed. The document explains how to read histograms and properly manipulate images using tools in Photoshop, ImageJ and GIMP.

Uploaded by

Ahmed El Sayed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Histogram Tool

The document discusses how to use histograms to analyze images and understand intensity distributions. Histograms show the distribution of intensity values in an image and can help determine if an image needs processing to improve contrast or has been over-processed. The document explains how to read histograms and properly manipulate images using tools in Photoshop, ImageJ and GIMP.

Uploaded by

Ahmed El Sayed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Image Processing using the Histogram Tool

Douglas Cromey, MS (SWEHSC Cellular Imaging Core)

One of the most useful tools in any image processing program is the histogram tool. A histogram shows the
distribution (count) of the intensity values in an image. If you learn how to “read” a histogram, you can
understand what is going on in your image and get ideas for methods to correctly manipulate the image. With a
histogram, you can usually tell an original image from a processed image.

Histogram tools can be found:


• Adobe Photoshop - located in either the WINDOW | HISTOGRAM palette or in the IMAGE | ADJUSTMENTS |
LEVELS tool
• FIJI (ImageJ) – located in a number of places, but the simplest is ANALYZE | HISTOGRAM, or ANALYZE |
COLOR HISTOGRAM (Note: ImageJ histograms tend to be on the small size, which can make it more
difficult to use them effectively)
• GIMP (free, open source image processing software) – located in COLORS | LEVELS

Greyscale Histograms
In the example shown, histogram A is of a low-contrast black & white
(8bit greyscale) image. Notice that the histogram does not use the full
width of the x-axis. There are no true blacks or whites in this image,
only mid-range grays. This is a “muddy” looking image.
A
Histogram B shows the image (after processing with Adobe
Photoshop) with much better contrast. The image uses most of the
available greyscale range from blacks to whites. Notice how the
histogram retains the same approximate shape as histogram A. There
are gaps in the continuous histogram that were created in this step
B
(Photoshop’s levels tool was used to stretch the histogram); however,
they do not show in this small histogram (see page 3). *
*
Over-exposing a device (e.g., CCD camera) causes problems in the
image that are similar to those caused by over-exposing film. In
certain areas of a film-based image, information is lost because of the
over-saturation of the film (e.g., outdoor photos where someone’s face C
Black White
has too much sunlight on it). Detection devices (e.g., cameras, photo-
multipliers) can be over-saturated and lose information as well. Another problem is that the images can also be
over-processed in software such that they lose information.

Histogram C shows what happens when the original image from A was over-processed in Adobe Photoshop
(brightness and contrast adjustment), although it could easily be from a piece of over-exposed film or an over-
saturated detector. The information represented by the far left and right sides of the histogram has now been
truncated (see the *, represented by a spike in the histogram at either 0 or 255). The general shape of the original
histogram is lost, roughly the top and bottom 20% of the intensity data has been pushed to the extremes, and (as
in histogram B) there are gaps in the histogram that do not show here.

Image Processing using the Histogram Tool Page 1


Problems caused by saturation in an image include:
• Loss of intensity and spatial resolution detail in the saturated areas. This detail can never be recovered.
• Blooming – because of the physics of camera sensors, a full (saturated) pixel on a camera chip can spill
some of its electron charge into adjacent pixels, causing the adjacent pixels to become brighter. This can
affect size measurements of objects, reduce image resolution (objects appear larger than they are), and
possibly throw off object counts because two (small and close together) objects may appear as just one
object.

Higher bit depth greyscale histograms


Many newer cameras and detectors used for fluorescence microscopy have higher numbers of grey shades.

8bit 10bit 12bit 14bit 16bit 24bit


Grey shades 256 1024 4096 32,766 65,536
Colors 256 indexed 16,777,216

There are several advantages to higher bit depths.


• Since random statistical and electronic noise in an image is usually found on the low end (black) of the
intensity scale, images that use the full range of the camera or detector avoid much of this noise.
• There are more grey shades to work with, which allows the user to capture data from the darkest to the
brightest points in the image. With careful setup, this can avoid the problem of saturating the image,
particularly at the high end of the histogram.
• If speed is needed, users can use less than the full bit-depth of the camera or detector. Post-processing
using a histogram stretch will get a very acceptable image (with possibly a bit more noise).

NOTE: In Adobe Photoshop, a higher bit depth image will be displayed using an 8bit (0-255) scale (e.g., the
histogram in the LEVELS tool) and the adjustment tools will only reference the 0-255 values. We are not sure why
this is the case, as it means that a user cannot make as granular an adjustment to the image as they might want.
GIMP also uses only 8bit values in its histograms and adjustment tools. In FIJI/ImageJ the histograms use higher
bit depths on both the x-axis and in the adjustment tools, but the display is similar to that of Photoshop (data is
summarized or “binned” to make it fit onto the graph).

Color Histograms
Color can be a very complicated subject. All of the software we have mentioned here (Photoshop, GIMP,
FIJI/ImageJ) will display a 24bit color image histogram in one of two ways. You will usually be presented first with
a histogram that represents luminance (think of luminance as what the pixel brightness would be if the color
image were converted to greyscale). You can also use the software to show the histogram for each (red, green,
blue) color channel. These single color histograms can vary widely, depending on what the image itself looks like.

Histogram stretch
A stretch is a very basic image processing technique that can improve
image contrast. Remember to always perform image processing on a copy
of the original image. In almost every instance, a histogram stretch is not
required to be reported. (NOTE: histogram equalization, while sounding
similar, is a very different and more aggressive image processing
technique).

Using the Photoshop levels tool on data in histogram A, the black point
and white point triangles (located right under the histogram) were moved

Image Processing using the Histogram Tool Page 2


to where the histogram data ends. The new histogram will now look
like histogram B, with the intensity data “stretched” to fit the entire
x-axis. The image will have more contrast (to the human eye)
because it will use all the greyscale data from black to white. The
stretch introduces gaps in the previously continuous histogram.

One caution, the middle arrow (the grey colored one) adjusts the
image gamma. Gamma is a non-linear adjustment that can be helpful
to shift data from the darker or lighter parts of the image (where the
After a histogram stretch
human eye has some difficulty discriminating differences) into the
middle grey levels. Gamma is considered a reportable form of image
manipulation. In the example to the right, the gamma was adjusted
aggressively. The histogram shows that there are larger gaps on the
white end of the scale, and “spikes” (individual data points that were
added together) on the black end of the scale.

NOTE: Original images typically have continuous histograms (no


gaps, see histogram A). As shown here, processed images frequently
have gaps in the histogram, or spikes in the data. The image The stretched histogram from above with a
intensity histogram cannot authoritatively prove that an image was gamma of 0.5 applied.
manipulated or not, but it is an easy place to start asking questions.

A caution about image post-processing


The best place to improve image contrast is at the beginning, when the user is sitting at the microscope. Follow
sample preparation best practices, and then try to capture the best images possible, ones that will require little or
no post-processing. There are several things that users can do to improve image quality, they include:

• Make sure that the microscope is properly aligned (see our handout on Köeller Illumination)
• Use only high-quality specimen preparations (i.e., no artifacts, with low non-specific background staining,
clean coverslips of the correct thickness, etc.)
• Use the full dynamic range of the image acquisition device without over-saturating (over-exposing) the
device.

Useful reference: Burger, W. and Burge, M.J. (2008) Histograms, in Digital Image Processing, Texts in Computer Science, Ch 4, 37-52,
Springer London http://www.springerlink.com/content/v534786r575lll14/

Mr. Cromey is grateful for the support he receives from the SWEHSC (P30-ES006694) and the UACC (P30-CA023074).
From the UA Microscopy Alliance - http://microscopy.arizona.edu/learn/printable-materials
©2017 The University of Arizona, Tucson, AZ (original 7/2000, updated 01/2018)

Image Processing using the Histogram Tool Page 3

You might also like