Histogram
Histogram
Intensity
values
such that
Interpreting Histograms
Log scale makes low values more visible
Difference between darkest and lightest
Histograms
Histograms help detect image acquisition issues
Problems with image can be identified on histogram
Over and under exposure
Brightness
Contrast
Dynamic Range
Point operations can be used to alter histogram. E.g
Addition
Multiplication
Exp and Log
Intensity Windowing (Contrast Modification)
Image Brightness
Brightness of a grayscale image is the average
intensity of all pixels in image
Image
Histogram
Image
Histogram
Original
Histogram
Original histogram
has only 2 intensities
(gray and white)
Returns histogram as an
array of integers
Large Histograms: Binning
High resolution image can yield very large histogram
Example: 32‐bit image = 232 = 4,294,967,296 columns
Such a large histogram impractical to display
Solution? Binning!
Combine ranges of intensity values into histogram columns
Increment corresponding
histogram
Color Image Histograms
Two types:
1. Intensity histogram:
Convert color
image to gray scale
Display histogram
of gray scale
2. Individual Color
Channel Histograms:
3 histograms (R,G,B)
Color Image Histograms
Recursive definition
Monotonically increasing
Real‐valued functions
for v = 1 .. h
for u = 1 .. w
set I(u, v) = f (I(u,v))
Non‐Homogeneous Point Operation
New pixel value depends on:
Old value + pixel’s location
(u,v)
Clamping
Deals with pixel values outside displayable range
If (a > 255) a = 255;
If (a < 0) a = 0;
Function below will clamp (force) all values to fall
within range [a,b]
Example: Modify Intensity and Clamp
Point operation: increase image contrast by 50%
then clamp values above 255
Increase contrast
by 50%
Inverting Images
2 steps
1. Multiple intensity by ‐1
2. Add constant (e.g. amax)
to put result in range
[0,amax]
Implemented as
ImageJ method
invert( ) Original Inverted Image
Image Negatives (Inverted Images)
Image negatives useful for enhancing white or
grey detail embedded in dark regions of an image
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Original Negative
s = 1.0 - r
Image Image
Thresholding
Linear
Negative/Identity
Logarithmic
Log/Inverse log
Power law
nth power/nth root
Logarithmic Transformations
Maps narrow range of input levels => wider range of
output values
Inverse log transformation does opposite
transformation
TheNew
general
pixel value form of the
s = log
c * transformation
log(1 + r) is Old pixel value
Log transformation of Fourier transform shows more detail
s = log(1 + r)
Power Law Transformations
Power law transformations have the form
Power
s=c*r γ
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
MagneticResonance
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
human spine
s = r 0.4
Differentpower values
highlight different
details
Intensity Windowing
A clamp operation, then linearly stretching image
intensities to fill possible range
To window an image in [a,b] with max intensity
M
Intensity Windowing Example
Contrasts
easier to see
Point Operations and Histograms
Effect of some point operations easier to observe on histograms
Increasing brightness
Raising contrast
Inverting image
Point operations only shift, merge histogram entries
Operations that merge histogram bins are irreversible
Combining histogram
operation easier to
observe on histogram
Automatic Contrast Adjustment
Linearly stretching
range causes gaps in
histogram
Histogram
Cumulative
Histogram
Histogram Equalization
Spreading out the frequencies in an image (or
equalizing the image) is a simple way to improve dark
or washed out images
Can be expressed as a transformation of histogram
rk: input intensity
sk: processed intensity
k: the intensity
range (e.g 0.0 –
1.0)
processed intensity sk T input intensity
(rk )
Intensity range
(e.g 0 – 255)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Equalization Examples
1
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Equalization Examples
2
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Equalization Examples
4
3
References
Wilhelm Burger and Mark J. Burge, Digital Image
Processing, Springer, 2008
Histograms (Ch 4)
Point operations (Ch 5)
University of Utah, CS 4640: Image Processing Basics,
Spring 2012
Rutgers University, CS 334, Introduction to Imaging
and Multimedia, Fall 2012
Gonzales and Woods, Digital Image Processing (3rd
edition), Prentice Hall