You are on page 1of 45

Spatial Domain Image Processing

Chapter 3
Image enhancement
• the term image enhancement refers to techniques
that enhance or emphasize certain features of
interest so that it looks better to an observer.
• The success or failure of image enhancement
techniques is therefore subjective – what looks
good to one person may not look good to another
person.
• Also the technique(s) employed for image
enhancement will depend to a large degree on the
application
• Techniques for image enhancement fall into two
categories:
• those that operate in the spatial domain and
• those that operate in the frequency domain.
• The term spatial domain refers to the image
plane itself, i.e. the pixels of the original image.
• The term frequency domain refers to an image
created by taking the Fourier transform of the
spatial domain image.
Spatial Domain Image enhancement
• The aim of image enhancement in the spatial
domain is to take a two-dimensional image
f(x,y) and produce a processed image g(x,y)
that is subjectively enhanced for a particular
application.
f ( x, y )  T ( g ( x, y ))
• where T is an operator defined over some
neighborhood of (x,y). Or set of input images
• The simplest case is where the neighborhood that T
operates over consists of a single pixel. In this case
the intensity of g(x,y) depends only on the intensity of
f(x,y). We denote this by
s  T (r )
• where s and t are the intensities at location (x,y) of
the images g(x,y) and f(x,y) respectively.
• These techniques are known as point processing
operations, or grey-level (or intensity) transformation
functions.
• More flexible techniques can be achieved by
making the intensity of each pixel in g(x,y)
dependent on the intensities of a neighborhood of
pixels in f(x,y).
• shows an example of such a neighborhood, which
are 3 by 3 pixels in size, although in principle any
size can be used.
• To calculate the intensity at g(x,y), the
enhancement operator T uses only the intensities in
f(x,y) that are the 3 by 3 neighborhood around (x,y).
• You can think of this neighborhood as a mask
that moves around the image showing which
pixels should be considered at each point.
• For this reason these techniques are known as
mask processing, convolution or spatial
filtering techniques, and the neighborhoods
are known as filters, kernels, templates,
windows or convolution masks.
Point Processing Operations
• The precise nature of the operator T
determines the type of grey-level
transformation that will take place.
Image Negatives
• The image negative transformation produces
images that look like photographic negatives.
The transformation can be defined by
• s  L 1 r
• where L is the number of possible intensity
values
• Image negative transformations can be useful
for enhancing white or grey detail in dark
regions of an image.
Log Transformations
• If an image is very dark it will be difficult to
discern detail in the image. In this case the log
transformation can be useful to enhance the
detail. The log transformation takes the form
s  c log(1  r )
• where c is a constant
Power-Law Transformations
• Power-law transformations have the basic form

s  cr
• where c and γ (gamma) are positive constants.
• For values of γ less than 1 the power-law
transformation is similar to the log
transformation, but when γ is greater than 1 the
effect of the transformation is changed
• high intensity values are ‘stretched’ and low
intensities are ‘compressed’.
• Power-law transformation is also known as
gamma correction.
• It is interesting to note here that power-law
transformations are similar in operation to the
brightness adaptation feature of the human
visual system.
Piecewise-Linear Transformations
• A piecewise-linear transformation is one that
would consist of a number of straight lines
joined together.
• Piecewise linear transformations give a lot
more flexibility in defining the relationship
between input and output intensities, but
they also require more user input.
• Contrast Stretching
• One limitation of power-law transformations is
that they can only ‘stretch’ the contrast of an
image at the low or high end of the intensity
range
• a piecewise-linear transformation that
provides more flexibility is known as contrast
stretching.
• There are two points (r1,s1) and (r2,s2) that
control the nature of the transformation. In
this case the effect is to ‘stretch’ the contrast
of the image between the intensities r1 and r2.
Grey-Level Slicing
• Another type of piecewise-linear
transformation is grey-level slicing. In this
technique we are interested in highlighting a
particular range of intensity values.
Image Histograms
• Image histograms offer a mathematical tool to
analyse and correct the distributions of grey-
levels in an image.
• The histogram of a digital image with grey-
levels in the range 0 to L-1 is a discrete
function h(rk) = nk, where rk is the kth grey-level
and nk is the number of pixels in the image
having grey-level rk.
• For example, h(100) is the number of pixels in
the image that have an intensity of 100. It is
common to normalise a histogram by dividing
each of its values by the total number of pixels
in the image, denoted by n.
• Therefore a normalised histogram is given by
p(rk) = nk /n, for k = 0, 1, …, L-1.
• The sum of all components p(rk) of a
normalised histogram is 1.
Histogram Equalisation
Arithmetic/Logic Operations
• Logic operations take two images as their input
and are performed on a bit-by-bit basis.
• Intensities are treated as strings of binary digits
and the logic operation operates on
corresponding bits in each image.
• The AND and OR operations can be useful in
masking images.
• Masking an image means selecting and
highlighting sub images in an image.
• Masking is sometimes referred to as region of
interest (ROI) processing, and is commonly
used as a pre-processing stage to isolate a part
of the image for further processing.
• The most common application for image
subtraction is in medical imaging
• A final application of arithmetic operations on
images is image averaging
Mask Processing Operations
• You can think of the m by n mask as being a
small image that is placed on top of the main
image, centered at the current pixel (x,y) and
reflected about the origin.
• When it is superimposed on the main image,
each pixel intensity in the mask is multiplied
with the intensity of the image pixel lying
‘underneath’ it.
• The results of all of these multiplications are
summed and the overall result becomes the
new pixel intensity at (x,y).
• This process is repeated for all pixels in the
image.
Smoothing Filters
• Smoothing filters are used for blurring and
noise reduction.
• blurring can be useful for removal of fine
detail prior to segmenting large objects.
• two categories of filter: linear and non-linear
filters.
• In general terms, an operator H is defined as
linear if, for any two images f and g and any
two scalars a and b,
H (af  bg )  aH ( f )  bH ( g )
• the result of applying a linear operator to the
sum of two images is identical to sum of the
results of applying the operator to each image
individually.
Linear Filters
• Linear smoothing filters are sometimes
referred to as averaging or lowpass filters
• Their effect is to ‘smooth out’ fine detail in the
image
Median Filter
• The median filter is an example of a non-linear
filter.
• Rather than computing a weighted average of
the neighborhood of pixels, it arranges the
pixels in ascending order and takes the middle
one in the sequence. This is known as the
median of the sequence.
example
• Median filters are particularly good at
removing the effects of impulse noise, also
known as salt-and-pepper noise.
• This type of noise consists of white (“salt”)
and black (“pepper”) dots superimposed onto
the original image.
Sharpening Filters
• it is often necessary to enhance them by
sharpening them.
• to enhance detail that has been blurred.
• we can think of image sharpening as the
opposite to image blurring, but both are
useful in certain applications.
Laplacian
• One of the most common sharpening filters is
the Laplacian. The Laplacian of an image f(x,y)

is denoted by ,f and its definition is
2

 2
f  2
f
2 f   .
x 2
y 2

• it is the sum of the second derivatives of the


image in the x and y directions. Since all
derivatives are linear operations, the Laplacian
is a linear operator.
Unsharp Masking & High-boost Filtering
• An alternative way of sharpening edges is
unsharp masking
• involves subtracting a blurred version of the
image from itself.
f s ( x, y )  f ( x, y )  f ( x, y )
• where denotes the sharpened image f s ( x, y )
• the original image f(x,y )and a blurred version
of the original image . f ( x, y )
• A variation of unsharp masking is called high-
boost filtering.
• when A = 1 in the filters shown in Figure
below then high-boost filtering becomes the
same as ‘standard’ Laplacian sharpening.
• If A > 1, high-boost filtering has the effect of
brightening the image. Therefore one
application of high-boost filtering is to
enhance dark images.
Gradient Filters
• first derivative (or gradient) information can
also be useful for image enhancement.

You might also like