Title: Chapter3 Image Enhancement in the Spatial Domain
1Chapter3Image Enhancement in the Spatial Domain
- 3.0 Introduction
- 3.1 Background
- 3.2 Some Basic Gray Level Transformations
- 3.3 Histogram Processing
- 3.4 Enhancement Using Arimethic/Logic Operations
- 3.5 Basics of Spatial Filtering
- 3.6 Smoothing Spatial Filters
- 3.7 Sharpening Spatial Filters
- 3.8 Combining Spatial Enhancement Methods
23.0 INTRODUCTION
- 1. Objective
- to process an image so that the result is more
suitable for specific applications. - 2. Categories
- a. spatial domain methods.
- b. frequency domain methods.
- c. combinations of above two types.
33.1 BACKGROUND
- 1. Operate directly on an image f by the
following way - g(x, y) T f (x, y)
- where g is the processed image and T is an
operator over an n ? n neighborhood of f - For simplicity in notation
- S T(r)
- r and s is the gray level of f(x,y)and g(x,y)
43.1 BACKGROUND
53.1 BACKGROUND
- 2. Point processing -- for n 1, i.e.,
- neighborhood the pixel itself
- 3. Mask processing -- also called filtering
- for n ? 1 neighborhood n ? n pixels using
masks.
64.2 ENHANCEMENT BY POINT PROCESSING
- 4.2.1 Some Simple Intensity Transformations
- 4.2.2 Histogram Processing
- 4.2.3 Image Subtraction
- 4.2.4 Image Averaging
74.2.1 Some Simple Intensity Transformations(1)
- 1. Image negatives
- given a pixel gray level ( g. l. ) r, output
pixel g. l. s is
L-1
T
s
L-1 largest g. l.
r
L-1
0
84.2.1 Some Simple Intensity Transformations(2)
- 2. Contrast stretching
- (1) Stretching is useful for improving image
contrast. - (2) General transformation diagram.
L-1 largest g. l.
94.2.1 Some Simple Intensity Transformations(3)
- (3) cases
- a. no change -- if r1 s1 , r2 s2 .
- b. thresholding -- if r1 r2, s1 0, and s2
L-1 - threshod value r1 r2.
- c. stretching -- if r1? r2 s1? s2 ( to keep
monotonicity of transformation ) - d. Why dies stretching improve image contrast?
- e. How to stretch is problem - dependent
104.2.1 Some Simple Intensity Transformations(4)
Mappings AgtT(A) (longer gt smaller)
L-1 largest g. l.
B gt T(B) (smaller gt larger ) CONTRAST IMPROVED)
C gt T(C) (larger gt smaller)
114.2.1 Some Simple Intensity Transformations(5)
- 3. Compression of dynamic ranges
- (1) Gray levels may be out of the display range
after certain transformations. - (2) One way to compress is
- S T( r ) c log(1 r )
- where c is a constant to make s to lie between 0
and L-1
124.2.1 Some Simple Intensity Transformations(6)
- 4. Gray level slicing
- (1) Highlighting a specific g. l. range
- (2) Useful for many applications.
- (3) Two approaches
- a. use high values for desired ranges and low
values for others - b. use high values for desired ranges and keep
the values for others. - (4) See Fig 4.7
13Fig 4.7
144.2.1 Some Simple Intensity Transformations(7)
- 5. Bit-plane slicing
- (1) Highlighting contributions made by specific
bits to image appearance. - (2) More important information is included in
higher- order bit planes details in others (see
Fig. 4.8 ) - (3) Bit - plane 7 ( highest - order ) result
of thresholding with threshold 128 - (4) See Fig. 4.9
15(No Transcript)
16(No Transcript)
17(No Transcript)
184.2.2Histogram Processing(1)
- 1. Definition and properties of histogram
- (1) the histogram of a given image f is a
function - P( rk ) nk / n
- where rk the kth g. l.
- nk the no. of pixels with g.l. rk
- n the total no. of pixels in f.
- (2) Diagram of histogram
194.2.2Histogram Processing(2)
- (3) Concept
- histogram p.d.f ( probability density
function ) - (4) A histogram gives the global appearance of an
image . - (5) Histograms of images with high and low
contrasts (see Fig. 4.10 )
20(No Transcript)
214.2.2Histogram Processing(3)
- 2. Histogram equalization
- (1) Equalization transformation of a given image
f -
- where Pr(w) is the histogram of f
- (2) S above is exactly the c. d. f. of r ( c. d.
f. cumulative distribution function )
224.2.2Histogram Processing(4)
- (3) It can be shown by probability theory (see
textbook) that the new image with g. l. s has a
uniform distribution, i.e., - (4) the transformation illustration
Pr(r)
Ps(s)
Equalization
r
S
Image with low contrast
Image with higher contrast
234.2.2Histogram Processing(5)
- (5) Read the example in pp. 176-177.
- (6) Histogram equalization is also called
histogram flatting or linearization. - (7) Discrete form of histogram equalization
244.2.2Histogram Processing(6)
- (8) A computation example
1
3
9
17
23
24
254.2.2Histogram Processing(7)
- (9) A major advantage of histogram equalization
for image contrast enhancement is that it can be
applied automatically. - (10) See Fig. 4.14 for a real example.
- 3. Histogram specification
- See textbook
- 4. Local enhancement
- See textbook
264.2.3Image Subtraction
- 1. Computes the difference g of two images f and
h - 2. For application example, see Fig. 4.17
274.2.4Image Averaging
- 1. Reduces noise by averaging several copies of
and identical image - 2. Method
- where gi(x, y) is one of copies of origin image
- 3. Why work ? Noise standard deviation can be
reduced to 1/n of origin - 4. See Fig. 4.18
284.3Spatial Filtering
- 4.3.1 Background
- 4.3.2 Smoothing Filtering
- 4.3.3 Sharpening Filtering
294.3.1 Background(1)
- 1. Spatial filtering is also called mask
processing. - 2. Masks ( also called spatial filters ) are used
- 3. High - frequency components in images
- noise, edges, sharp details, etc.
- 4. Low - frequency components in images
- uniform regions, slow - changing background g.
l., etc. - 5. Type of spatial filtering
- (1) lowpass filtering
- useful for image blurring (smoothing)
304.3.1 Background(2)
- (2) Highpass filtering
- useful for image sharpening
- (3) Bandpass filtering
- mostly used in image restoration
- 6. See Fig 4.19 for the above 3 types.
- 7. Linear mask operation
314.3.1 Background(2)
- Operation replace z5 by
- R M?N z1?w1 z2?w2 . z9?w9
- 8. Nonlinear mask operation
- R is computed nonlinearly using information of
the neighborhood of current pixel as well as the
mask.
Z5 g. l. of current pixel
Mask M
Neighborhood N
324.3.2Smoothing Filters(1)
- 1. Used for image blurring noise reduction.
- 2. Useful for removing small details and bridging
small gaps in lines or curves. - 3. Lowpass spatial filtering
- (1) Mask for 3?3 neighborhood
334.3.2Smoothing Filters(2)
- (2) Operation -- replace z5 by
- (3) Also called neighborhood averaging
- (4) See Fig. 4.22 for effect
- 4. Median filtering
- (1) Reducing noise without blurring images
344.3.2Smoothing Filters(3)
- (2) Operation --
- replace g. l. at (x, y) with the median of all
the g. l. of neighborhood. - (3) Meaning of median
- value r such that
- (i.e., r (1/2)tile of the p.d.f. )
P(x)
r median
x
Area 1/2
354.3.2Smoothing Filters(4)
- (4) An example
- given
-
- g. l. z5 15 is replaced by median 20
- (5) For effect of median filtering, see Fig. 4.23
364.3.3Sharpening Filters(1)
- 1. Objective
- highlighting or enhancing fine details in images.
- 2. Applications
- (1) electronic printing
- (2) medical imaging
- (3)industrial inspection
- (4) target detection
- etc.
374.3.3Sharpening Filters(2)
- 3. Basic highpass spatial filtering (HPSF)
- (1) Mask for 3?3 neighborhood
- (2) See Fig. 4.25 for effect of filtering
- 4. High best filtering
- (1) Also called high-frequency emphasis
filtering.
384.3.3Sharpening Filters(3)
- (2) Method
- high-best A ? (original) - lowpass
- (A-1)(original) original - lowpass
- (A-1)(original) highpass
- where A is a selected weight.
- (3) Note that part of the original image is added
back. - (4) Equivalent mask
- (5) See Fig. 4.27 (A1.1 is enough)
Where w9A-1 (A 1 ? basic HPSF)
394.3.3Sharpening Filters(4)
- 5. Derivative filters
- (1) Concept -
- (2) The most common differentiation operation is
the gradient
404.3.3Sharpening Filters(5)
- (3) Gradient
- a. definition -- the gradient of a function f at
a pixel (x0, y0) is - b. magnitude of gradient --
414.3.3Sharpening Filters(6)
- (4) Approximation of gradient magnitude
- a. Assume the neighborhood (nbhd) g. l. of the
pixel at (x, y) are - b. in continuous form
With g. l. at (x, y) z5
or
424.3.3Sharpening Filters(7)
- C. in absolute difference form
- d. Roberts operators for 2 ? 2 nbhd
- operation N ? MR1 N ? MR2 z5-z9
z6 - z8
or
MR1
MR2
434.3.3Sharpening Filters(8)
- d. Prewitt operators for 3 ? 3 nbhd
- operation N ? MP1 N ? MP2
- (z7z8z9) - (z1z2z3) (z3z6z9) -
(z1z4z7) - e. Sobel operators for 3 ? 3 nbhd
- operation N ? MS1 N ? MS2
- (z72?z8z9) - (z12?z2z3)
- (z32?z6z9) - (z12?z4z7)
MP1
MP2
MS1
MS2
444.4 Enhancement in Frequency Domain
- 4.4.1 Lowpass Filtering
- 4.4.2 Highpass Filtering
- 4.4.3 Homomorphic Filtering
454.4.1 Lowpass Filtering(1)
- 1. Use
- image blurring ( smoothing )
- 2. Goal
- Want to find a transfer function H(u, v) in the
frequency domain to attenuate the high frequency
in the FT F(u, v) of a given image f using the
inverse FT
464.4.1 Lowpass Filtering(2)
- 3. Ideal lowpass filter (ILPF)
- (1) Definition --
- H(u, v) 1 if D(u, v) ? D0
- 0 otherwise
- where D(u, v) distance from (0, 0) to (u, v)
- and D0 is a constant ( called cutoff frequency )
- (2) See Fig 4.30 for the filter shape in 3-D and
2-D - (3) The ILPF cannot be implemented by analog
hardware ( but can be implemented by software ) - (4) Before seeing effects of the ILPF, we need to
review more properties of the FT first.
474.4.1 Lowpass Filtering(3)
- 4. Additional review of the Fourier transform
- See sec.3.23.4 for FT, DFT, FFT
- See Fig. 4.31 for an example of Fourier spectrum
( or simply called spectrum ) - 5. See Fig. 4.32 for effects of applying the ILPF
using different cutoff frequencies. - 6. The ILPF produces ringing effects see Fig.
4.32(d) for an example and see Fig. 4.33 for the
reason. Note Fig. 4.33(a) is equivalent to the
top view of a 2-D sinc function.
484.4.1 Lowpass Filtering(4)
- 7. Butterworth lowpass filter ( BLPF )
- (1) A BLPF of order n with cutoff frequency at D0
is defined as - where A 1 or 0.414
- (2) See Fig. 4.34 for the shape of the BLPF.
- (3) See Fig. 4.35 for the effects of applying the
BLPF with n 1 for 5 D0 values. - 8. The BLPF produces no ringing effect due to the
smoothness of its transfer function where A1 or
0.414
494.4.2 Highpass Filtering(1)
- 1. Use
- Image sharpening
- 2. Ideal highpass filter (IHPF)
- (1) Transfer function
- H(u, v) 0 if D(u, v) ? D0
- 1 otherwise
- (2) See Fig. 4.37 for shapes of the IHPF.
504.4.2 Highpass Filtering(2)
- 3.Butterworth highpass filter (BHPF)
- (1) Transfer function
- where A 1 or 0.414
- (2) See Fig. 4.38 for shapes of the BHPF.
- 4.4.3 Homomorphic Filtering
- 4.5 Generation of spatial masks from frequency
domain specifications - Read the textbook
514.6Color Image Processing
- 4.6.0 Introduction
- 4.6.1 Color fundamentals
- 4.6.2 Color models
- 4.6.3 Pseudo-color image processing
- 4.6.4 Full color image processing
524.6.0Introduction
- 1. Motivation
- (1) Color is a powerful descriptor for automated
image analysis. - (2) The human eye can discern thousands of color
shades and intensities ( but about only a dozen
of grey levels ) - 2. Study areas
- (1) full color image processing
- still in infancy
- (2) Pseudo - color image processing
- assigning color shades to monochrome intensity
images
534.6.1Color Fundamentals(1)
- 1. Colors of light
- (1) Primary -- red (R), green (G), and blue (B)
- (2) Secondary -- magenta (RB),
- cyan (GB)
- yellow (RG)
- (3) See plate III(a) for illustration.
- 2. Colors of pigments (colorants) --
- (1) Primary -- magenta, cyan, and yellow
- (2) Secondary -- red, green, and blue
- (3) See plate III(b) for illustration.
544.6.1Color Fundamentals(2)
- 3. Characteristics of color
- (1) Three basic characteristics
- a. brightness -- chromatic notion of intensity
- b. hue -- dominant wavelength (color) perceived
by human eyes - c. saturation -- amount of white light mixed with
hue - (2) Chromaticity -- hue saturation
- (3) trimulus values
- amounts of red, green, and blue (denoted as X, Y,
and Z, respectively ) for a color
554.6.1Color Fundamentals(2)
- (4) trimulus coefficients -- x, y, z, with
- x X / (X Y Z)
- y Y / (X Y Z)
- z Z / (X Y Z)
- (5) Chromaticity diagram -- Plate IV
564.6.2Color models(1)
- 1. Models
- (1) RGB (red, green, blue ) model
- useful for hardware e. g., color monitors, TV
cameras, etc - (2) CMY ( cyan, magenta, yellow ) model
- useful for color printers
- (3) YIQ ( luminance, inphase, quatrature ) model
- useful for color TV broadcasting
- (4) HSI (hue, saturation, intensity ) model
- useful for color image manipulation
- (5) HSV (hue, saturation, value ) model
- useful for color image manipulation
574.6.2Color models(2)
- 2. Models most frequently used in image
processing - RGB, YIQ, HIS
- 3. RGB model
- (1) Good for analysis of aerial satellite
multispectral image data ( including 4 images of
G, R and two infrared ). - (2) No good for natural scene image processing if
R, G, B are treated separately ( e. g., human
face processing ). - (3) See Fig. 4.44 for RGB color cube.
584.6.2Color models(3)
- 4. YIQ model
- (1) Y represents the luminance component.
- (2) Y and color information ( i.e., I Q ) are
decoupled. - (3) Contrast enhancement of an image in the YIQ
model can be achieved by applying histogram
equalization to the Y component only. - 5. HSI model
- (1) I represents intensity.
- (2) advantages
- a. I and color information ( i.e., H S ) are
decoupled
594.6.2Color models(4)
- b. color information represented by H S is
close to the color observed by eyes. - (3) Good for human color inspection works.
- 6. Model conversions
- (1) RGB ? YIQ -- use Eq. 4.6-6
- (2) RGB ? HSI -- use Eq. 4.6-11, 18, 21 for I, H,
S - (3) HSI ? RGB -- for detail, see pp 236-237 of
the textbook.
604.6.3 Pseudo - color image processing(1)
- 1. Purpose
- to assign color to monochrome images based on
properties of gray - level content of images. - 2. Method
- (1) Intensity slicing
- (2) Gray level to color transformation
- (3) Filtering
- 3. Intensity slicing
- (1) slicing into two colors means the following
transformation
614.6.3 Pseudo - color image processing(2)
- (2) General slicing means the following
transformation
Color
cM
c2
c1
L
I1
I2
IM
624.6.3 Pseudo - color image processing(3)
- 4. Gray level to color transformation
- (1) More general than intensity slicing.
- (2) Method
- feed image gray level into three (RGB)
independent transformation functions and display
the results in a color monitor ( see Fig. 4.50
for illustration ) - (3) For example, see Fig. 4.51 and Plate VI.
- (4) Advantages
- specific details in images may be emphasized.
634.6.3 Pseudo - color image processing(4)
- 5. A filtering approach
- (1) The principle is the same as that of gray
level to color transformation except that the
transformation are performed in the frequency
domain. - (2) See Fig. 4.52 for illustration.
- (3) Various forms of bandreject filters are used
here ( see the textbook
644.64 Full Color Image Processing
- 1. Only color image enhancement is discussed
here. - 2. When the HIS model is used, intensity is
decoupled from color information. So, we can
enhance the I component using any enhancement
technique for monochrome images. - 3.Detail procedure when the RGB model is used
- RGB HSI HIS RGB
- 4. See Plate IX for an example.