Title: 3'1 Background
1Chapter 3 Image Enhancement in the Spatial Domain
- 3.1 Background
- Specific applicationproblem oriented
- Trial and error is necessary
- Spatial domain will be denoted by the expression
g(x,y)Tf(x,y) - The simplest form of T sT(r)
- Contrast stretching (Fig. 3.2 (a))
- Thresholding function binary image (Fig. 3.2)
- Masks (filters, kernels, templates, windows)
- Enhancement mask processing or filtering
- 3.2 Some gray level transformations
- Three basic types of functions used for image
enhancement - Linear
- logarithmic
- Power-law
2- 3.2.1 Image negatives
- Is obtained by using the negative transformation
sL-1-r - Produces the equivalent of a photographic
negative - Suited for enhancing white or gray detail
embedded in dark regions of an image - 3.2.2 Log transformations
- The general form of the log transformation
sclog(1r) - Expand the values of dark pixels while
compressing the high-level values - Compress the dynamic range of images with large
variations - 3.2.3 Power-law transformation
- The basic form
- Gamma correction
- CRT device have an intensity-to-voltage response
that is a power function - Produce images that are darker than intended
- Is important if displaying an image accurately on
a computer screen
3Chapter 3 Image Enhancement in the Spatial Domain
4Chapter 3 Image Enhancement in the Spatial Domain
5Chapter 3 Image Enhancement in the Spatial Domain
6Chapter 3 Image Enhancement in the Spatial Domain
7Chapter 3 Image Enhancement in the Spatial Domain
8Chapter 3 Image Enhancement in the Spatial Domain
9- Low r wash-out in the background (Fig. 3.8
r0.3) - High r enhance a wash-out appearance (Fig. 3.9
r5.0 areas are too dark) - 3.2.4 Piecewise-linear transformation functions
- Advantage the form of piecewise functions can be
arbitrary complex over the previous functions - Disadvantage require considerably more user
input - Contrast stretching
- One of the simplest piecewise function
- Increase the dynamic range of the gray levels in
the image - A typical transformation control the shape of
the transformation - r1r2 s10 and s2L-1
- Gray level slicing
- Highlight a specific range of gray levels
- Display a high value for all gray levels in the
range of interest and a low value for all other
gray levels produce a binary image - Brighten the desired range of gray levels, but
preserves the background and gray level
tonalities (Fig. 3.11) - The higher order bits (especially the top four)
contain the majority of the visually significant
data
10Chapter 3 Image Enhancement in the Spatial Domain
11Chapter 3 Image Enhancement in the Spatial Domain
12Chapter 3 Image Enhancement in the Spatial Domain
13Chapter 3 Image Enhancement in the Spatial Domain
14- Bit-plane slicing
- Highlight the contributions made to total image
appearance by specific bits - higher order bits contain the majority of the
visually significant bits - Separating a digital image into its bit plane is
suitable for analyzing the relative importance
played by each bit of the image - Useful for image decomposition
- The binary image for bit-plane 7 like a
thresholding function
15Chapter 3 Image Enhancement in the Spatial Domain
16Chapter 3 Image Enhancement in the Spatial Domain
17Chapter 3 Image Enhancement in the Spatial Domain
183.3 Histogram processing
- Histogram of a digital image--the gray levels in
the range0, L-1 - The sum of all components of a normalized
histogram is equal to 1 - Low contrast a narrow histogram, a dull,
wash-out gray look - High contrast cover a broader range of the gray
scale and the distribution of pixels is not too
far uniform, with very few vertical lines being
much higher than the others - A great deal of details and high dynamic range
- 3.3.1 Histogram equalization (Histogram
linearization) - Histogram of ST (r) 0? r?1
- Produce a level s for every pixel value in the
original image, the transformation satisfies the
following conditions - (1) T(r) is single-valued and
monotonically increasing in the interval - 0? r? 1 and
- (2) 0? T ( r ) ? 1 for
0? r? 1 - rT-1(s) 0? s? 1
19- The goal of this operation--produce an output
image that - has a uniform histogram
- The results are predicable and the method is
simple to implement - Probability density function continuous
- For discrete values probability and summation
instead of density functions Pr(rk)( the
discrete version of the transformation function - Spread the histogram of the input image so that
the levels of the histogram - Equalized image will span a fuller range
- The results are predicable, and the method is
easy to implement automatically
20- To enhance the contrast of a monochrome image
- Construct a histogram of the grey levels present
- 256 bins representing 0 through 255
- Each bin is the number of pixels with that grey
level - Remap the grey levels so that the histogram is
(roughly) flat - To ensure that every collection of N adjacent
bins has the same pixel count - All pixels within one bin in the input image will
be within one (possibly different) bin in the
output image. That is, two pixels with equal grey
level in the input image will have equal grey
level in the output image. - For some adequately small value of N (i.e., at
some adequately fine scale), collections of N
adjacent bins will not have the same pixel count.
- The pixels must be dithered to equally fill all
bins, including those that would not have had any
pixels at all. Note that dithering adds a
(pseudo) random value to the pixel's grey level.
21Chapter 3 Image Enhancement in the Spatial Domain
22(No Transcript)
23(No Transcript)
24Chapter 3 Image Enhancement in the Spatial Domain
25Chapter 3 Image Enhancement in the Spatial Domain
263.3.2 Histogram matching (specification)
- Enhancement based on a uniform histogram is not
the best approach - It is useful sometimes to specify the shape of
the histogram that we wish to have - Generate a processed image that has a specified
histogram - Suitable for interactive image enhancement
- Difficulty--build a meaningful histogram
- The smallest integer in the interval 0,L-1 such
that - The procedure for histogram matching (Page 99)
27 - Two pixels with equal grey level in the input
image will not necessarily have equal grey level
in the output image. - Remapping without dithering seems the most
appropriate for scientific data - Improve the visual information as must as
possible without intentionally adding randomness.
- 3.3.3 Local Enhancement
- Enhance details over small areas--- in the
neighborhood of every pixel in the image - Local histogram equalization
28- Linear or non-linear transformation
- Based on gray level distribution around the
neighborhood of a pixel (convolution mask) - Define a square or rectangular neighborhood and
move the center of the area - At each location, the histogram of the points in
the neighborhood is computed - A histogram equalization or specification
function is obtained - This function is use to map the gray level of the
pixel centered in the neighborhood - The center of the neighborhood is then moved to
an adjacent pixel - Use very little a priori knowledge about the
image contents - The choice of the transformation, size, and shape
of the neighborhood depends on the size of objects
29Chapter 3 Image Enhancement in the Spatial Domain
30Chapter 3 Image Enhancement in the Spatial Domain
31Chapter 3 Image Enhancement in the Spatial Domain
32Chapter 3 Image Enhancement in the Spatial Domain
33- 3.3.4 Use of histogram statistics for image
enhancement - Use statistical parameters obtained from the
histogram - Estimate of occurrence of gray level ri
- The nth moment of r about the mean is defined as
- Global mean and variance , local mean and
variance - The mean value of the pixel in Sxy is
- The gray level variance of the pixels in the
region is given by - The local mean is a measure of average gray level
- The variance is a measure of contrast
- Using Local mean and variance is flexible and
depends on image appearance
34Continue
- Enhance low contrast of an area
- Consider the pixel at a point (x,y) as a
candidate for processing - if
- determine whether the contrast if an area makes
it a candidate for enhancementif - A summary of the enhancement
35Chapter 3 Image Enhancement in the Spatial Domain
36Chapter 3 Image Enhancement in the Spatial Domain
37Chapter 3 Image Enhancement in the Spatial Domain
38Chapter 3 Image Enhancement in the Spatial Domain
393.4 Enhancement using arithmetic/logic operations
- Image subtraction g(x,y)f(x,y)-h(x,y)
- Masking
- is referred to as ROI (region of interest)
processing - Isolate an area for processing
- Arithmetic operations
- Addition
- Subtraction
- Multiplication used to implement gray-level
rather than binary - Division
- Logic operations
- And used for masking (Fig. 3.27)
- Orused for masking
- Not operation negative transformation
- Also are used in conjunction with morphological
operations
40Chapter 3 Image Enhancement in the Spatial Domain
41- 3.4.1 Image subtraction
- The difference between two images f(x,y) and
h(x,y) is expressed as g(x,y)f(x,y)-h(x,y) - Enhance the difference of two images
- Contrast stretching transformationuseful for
evaluating the effect of setting to zero the
lower-order planes (Fig. 3.28(d)) - Mask mode radiography (Fig 3.29)
- Sort of scaling solve image values outside form
the range 0 to 255 (-255 to 255) - (1) Add 255 to every pixel and divide by 2 fast
and simple to implement, but the full rang of the
display may not be used - (2) more accuracy and full coverage of the 8-it
range - The values of the minimum difference is obtained
and its negative added to all the pixels in the
difference image - All the pixels in the image are scaled to 0,255
by multiplying 255/Max - 3.4.2 Image averaging
- g(x,y)f(x,y)?(x,y) (assume every pair of
coordinates (x,y) the noise is uncorrelated and
has zero average value)
42Chapter 3 Image Enhancement in the Spatial Domain
43Chapter 3 Image Enhancement in the Spatial Domain
44- Reduce the noise content by adding a set of noise
images gi(x,y) - An image is formed by averaging K different noisy
images - As k increases, the variability of the pixel
values at each location (x,y) decreases - The image gi(x,y) must be registered in order to
avoid the introduction of blurring - Use integrating capabilities of CCD or similar
sensors for noise reduction by observing the same
scene over long periods of time - 3.5 Basics of spatial filtering
- Sub-image (filter, mask, kernel, template or
window) - Frequency domain
- Spatial domain
- Linear spatial filtering is give by a sum of
products of the filter coefficients R - In general, linear filtering of an image with a
filter mask of size MxN is given by g(x,y) - Convolving a mask with an image by pixel-by-pixel
basis
45Chapter 3 Image Enhancement in the Spatial Domain
46Chapter 3 Image Enhancement in the Spatial Domain
47Chapter 3 Image Enhancement in the Spatial Domain
48Chapter 3 Image Enhancement in the Spatial Domain
49- 3.6 Smoothing spatial filters
- Used for blurring and for noise reduction
- Blurring is used for removal of detail and
bridging of small gaps in lines or curves - 3.6.1 Smoothing linear filters
- Averaging filter (low pass filter)
- Replace the value of every pixel by the average
of the gray levels in the neighborhood by the
filter mask - Reduce sharp transition (such as random noise)
- Blur edges
- The average of the gray levels in the 3x3
neighborhoods - Averaging with limited data validity
- only to pixels in the original image in a
pre-defined interval of invalid data - Only if the computed brightness change of a pixel
is in some pre-defined interval
50- Weighted average (Fig. 3.34)
- Blur an image for the purpose getting a gross
representation of objects of interest - The intensity of smaller objects blends with the
background and larger objects become blob-like
and easy to detect (Fig. 3.36) - 3.6.1 Order Statistics filters (rank filters)
- Nonlinear spatial filter based on ordering
(ranking) - Median filter
- Remove impulse noises (salt and pepper noises)
- Represent 50 percent of a ranked set
- Large clusters are affected considerably less
- Min filter
- Max filter--useful in finding the brightest
points - Non-linear mean filter
- Arithmetic mean
- Harmonic mean
- Geometric mean
51Chapter 3 Image Enhancement in the Spatial Domain
52Chapter 3 Image Enhancement in the Spatial Domain
53Chapter 3 Image Enhancement in the Spatial Domain
54Chapter 3 Image Enhancement in the Spatial Domain
55- 3.7 Sharpening spatial filter
- Highlight fine detail or enhance detail
- Enhance detail that has been blurred
- Application ranging from electronic printing and
medical imaging to industrial inspection - Can be accomplished by digital differentiation
- 3.7.1 Foundation
- Sharpening filter based on first- and
second-order derivatives - Definition of first derivatives
- Must be zero in flat segment
- Muse be nonzero at the onset of a gray level step
or ramp - Must be nonzero along the entire ramp (thick
edge) - Nature of first Derivate
- Produce thick edges
- Has a strong response to gray-level step
56- Definition of second derivatives is better
suited than the first-derivative for image
enhancement - Must be zero in flat areas
- Muse be nonzero at the onset and end of a gray
level step or ramp - Must be zero along ramps of constant slope
- Nature of a second order derivate
- Produces finer edges
- Enhance fine detail (including noise) much more
than a first order derivate for example a thin
line - The response at an isolated point is stronger
than first Der. - Has a transition form positive back to negative
- Produce a double response to a gray-level step
- Highlight the fundamental similarities and
differences between first- and second- order
derivatives (Fig. 3.38)
57Chapter 3 Image Enhancement in the Spatial Domain
583.7.2 Use of second derivatives for enhancement
The Laplacian
- Consists of defining a discrete formulation of
the second-derivative and then construct a filter
mask - Isotropic filter (rotation invariant)
independent of the direction of the
discontinuities in the image - Development of the method (Laplacian)
- Is the simplest isotropic derivative operator
(linear operator) - A function of f(x,y) of two variables is defined
as - Filter mask used to implement the Laplacian (Fig.
3.39) - Diagonal or no diagonal
- Highlight gray-level discontinuities and
de-emphasizes regions with slowly varying gray
levels - Shortcoming Produces images that grayish edge
lines and other discontinuities, all superimpose
on a dark, featureless background image
59Continue
- To overcome the shortcoming of the operation
- Enhance small detail and preserve background
tonality recover background features while
preserving the sharpening effect - By adding the original and Laplacian images (Fig.
3.40) - A negative center coefficient--subtract sharpen
result - A positive center coefficientadd sharpen result
- Simplification
- Composite Laplacian mask
- no diagonal neighbors
- Diagonal neighborssharper than no diagonal
neighbors
60Chapter 3 Image Enhancement in the Spatial Domain
61Chapter 3 Image Enhancement in the Spatial Domain
62- Unsharp masking and high-boost filtering
- Un-sharp masking expression-subtract a blurred
version of an image from the image itself - The dark room photography
- A further generalization of un-sharp masking
high-boost filtering - Expression for computing a high-boost filtered
image - The center coefficient of the Laplacian
masknegative or positive - Can be implemented with either one of these mask,
with A?1 - 3.7.3 Use of first derivatives for
enhancement-The Gradient - The gradient of f at coordinates (x,y) is
63- The components of the vector are linear operator
- The magnitude of this vector is
or - Preserve relative changes in gray levels, but the
isotropic property is lost - Is not a linear operator
- The partial derivatives of the gradient vector
are not rotation invariant - Give the same result only for vertical and
vertical edges - The magnitude of the gradient vector is rotation
invariant
64Chapter 3 Image Enhancement in the Spatial Domain
65Chapter 3 Image Enhancement in the Spatial Domain
66Chapter 3 Image Enhancement in the Spatial Domain
67- Approximate the magnitude of the gradient by
using absolute values - Lost isotropic feature property
- Vertical and horizontal edges preserve the
isotropic properties only for multiples of 90 - Mask of odd sizes
- Robert operator
- Robert Ross-gradient operators
- An approximation using absolute values (3.7-18)
- Sobel operator
- Use a weight value of 2 to achieve some smoothing
by giving more importance to the center point - Constant or slowly varying shades are eliminated
- Prewitt operator
68Chapter 3 Image Enhancement in the Spatial Domain
69Chapter 3 Image Enhancement in the Spatial Domain
703.8 Combining spatial enhancement methods
- Application of several complementary enhancement
techniques - Laplacian
- Adv. highlight fine detail
- Dis-adv produce noisier results than the
gradient - Gradient
- Enhance prominent edges
- Has a stronger response in area of significant
gray-level transitions - Further lower the response of fine detail and
noise for the gradient - Mask the Laplacian image with a smoothed version
of the gradient image - Smooth the gradient and multiply it by the
Laplacian image - Preserve details in the strong area while
reducing noise in the relatively flat areas
71- Enhance the image by sharpening it and bringing
out more detail (Fig. 3.46) - Nature of the image the narrow dynamic range of
the gray levels and high noise content