0% found this document useful (0 votes)
19 views35 pages

UNIT-2 Image Enhancement (Updated)

The document discusses image enhancement techniques in the spatial domain, focusing on methods that manipulate pixel values directly. It covers various transformation functions, including linear, logarithmic, power-law, and piecewise-linear transformations, as well as histogram processing and filtering techniques for noise reduction and sharpening. Additionally, it introduces frequency domain methods, detailing low-pass and high-pass filters, and the application of Fourier transforms in image processing.

Uploaded by

musiciansingh01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views35 pages

UNIT-2 Image Enhancement (Updated)

The document discusses image enhancement techniques in the spatial domain, focusing on methods that manipulate pixel values directly. It covers various transformation functions, including linear, logarithmic, power-law, and piecewise-linear transformations, as well as histogram processing and filtering techniques for noise reduction and sharpening. Additionally, it introduces frequency domain methods, detailing low-pass and high-pass filters, and the application of Fourier transforms in image processing.

Uploaded by

musiciansingh01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

UNIT-2

IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

Introduction to Image enhancement:


 Image enhancement is to process a given image so that the result is more
suitable than the original image for a specific application.

 Objective of Image enhancement


Principle objective of Image enhancement is to process an image so that result
is more suitable than original image for specific application

 Image enhancement approaches fall into two broad categories:


1. Spatial domain methods
2. Frequency domain methods

 Spatial domain: - based on direct manipulation of pixels in an image.

 Frequency domain: - based on modifying the Fourier transform of an image.

1. Spatial domain:-

1
Spatial domain refers to the image plane itself, and approaches in this category are
based on direct manipulation of pixels in an image.

Spatial domain processes will be denoted by the expression

g (x, y) = T [f (x, y)]

Where,
f(x, y) - input image,
g(x, y) - processed image
T - Operator on f, defined over some neighborhood of (x, y).

The neighborhood about a point (x, y) is to use a square or rectangular sub image area
centered at (x, y)

Figure 1: 3*3 neighborhood about a point (x, y) in an image.

The center of sub image is moved from pixel to pixel starting at the top left
corner. The operator T is applied to each location (x,y) to find the output g at
that location . The process utilizes only the pixel in the area of the image
spanned by the neighborhood.

Basic Gray Level Transformation Functions

Here, T is a gray-level transformation function of the form:


s = T(r)
Where, r and s - denote the gray level of f(x, y) and g(x, y) at any point (x, y).

2
(a) (b)

Figure 2 a, b: Gray level transformation functions for contrast enhancement.

Image enhancement can be done through gray level transformations which are
discussed below.

Intensity/ Gray Level Transformations:

These are the simplest image enhancement techniques.

1. Linear (negative & Identity) transformation

2. Logarithmic (log & inverse) transformations

3. Power law(nth & nth root) transformations

4. Piecewise-Linear transformation functions

1. Linear transformation

1. Image Negative:-

The negative of an image with gray levels in the range [0, L-1] is obtained by using the
negative transformation.

S=L–1-r
Where r= gray level value at pixel (x,y)
L is the largest gray level consists in the image
3
i. If r=0, S = L – 1
ii. If r=L – 1, S = 0

Fig. Negative transformations

This type of processing is particularly suited for enhancing white or gray detail embedded in dark
regions of an image, especially when the black areas are dominant in size.

2. Logarithmic transformations

Logarithmic transformation further contains two type of transformation. Log


transformation and inverse log transformation.

a) Log Transformations:
The log transformations can be defined by this formula
s = c log (1 + r)
Where S and r are the pixel values of the output and the input image and c is a
constant and it is assumed that r ≥ 0
During log transformation, the dark pixels in an image are expanded as compare to the
higher pixel values. The higher pixel values are kind of compressed in log
transformation. This result in following image enhancement

The inverse log transformation is opposite to log transformation so will reduce


low contrast image.

4
3. Power-Law Transformations
Power-law transformations have the basic form
s = c ry
Where c and γ are positive constants. Also can be represented as

s = c (r+ε) y
This symbol γ is called gamma
We use gamma transformation where we need to expand or compress darker region
i. If γ = 1, No change
ii. If γ > 1, compresses dark values and expands bright values
iii. If γ < 1, expands dark values Compresses bright values

5
Power law curves with fractional values of y map a narrow range of dark input values
into a wider range of output values, with the opposite being true for higher values of
input gray levels. We may get various curves by varying values of y.

Piecewise-Linear Transformations

1. Contrast Stretching
 It is the simplest piecewise linear transformation function
 The idea behind contrast stretching is to increase the dynamic range of
gray levels in the image being processed.

a) If r1=s1 and r2=s2, linear transformation


b) If r1=r2 & s1=0, s2=L-1, thresholding
c) Intermediate values of (r1, s1) and (r2, s2) produce various degrees of spread
in the gray value

6
2. Gray-level Slicing
Gray level slicing is used to Highlighting a specific range of gray levels in an image.

For example when enhancing features such as masses of water in satellite


image and enhancing flaws in x- ray images.

There are two methods of doing this-

(1) One method is to display a high value for all gray level in the range of interest and
a low value for all other gray level

(2) Second method is to brighten the desired ranges of gray levels but preserve the
background and gray level tonalities in the image.

7
3. Bit-plane Slicing
 Highlighting the contribution made to total image appearance by specific bits
might be desired.
 It is useful in image compression.

Suppose that each pixel in an image is represented by 8 bits. Imagine that the image is
composed of eight 1-bit planes, ranging from bit-plane 0 for the least significant bit to
bit plane 7 for the most significant bit. In terms of 8-bit bytes, plane 0 contains all the
lowest order bits in the bytes comprising the pixels in the image and plane 7 contains
all the high-order bits.
Example 1:- find the bit planes of given 3x3 image

Solution:

8
Example 2: find the bit planes of given 3x3 image

Solution: binary representation of given image

Histogram Processing
The histogram of a digital image with gray levels in the range [0, L-1] is a discrete
function
h(rk)=nk

Where rk is the kth gray level and nk is the number of pixels in the image having gray
level rk.

p(rk) is an estimate of the probability of occurrence of intensity level rk in an image.

9
Histogram Equalization
Histogram equalization is a technique for enhancing the appearance of images.

Let us consider the transformations as,


s=T(r), where 0 ≤ r ≤ 1
We assume that the transformation function T(r) satisfies the following conditions:

a. T(r) is a monotonically increasing function in the interval 0 ≤ r ≤ L-1:


b. 0 ≤ T(r) ≤ L-1 for 0 ≤ r ≤ L-1:

Equalization automatically determines a transformation function that seeks to produce


an output image that has a uniform histogram. It is a good approach when automatic
enhancement is needed

Histogram Equalization (Example)

10
Solution: based on above table histogram of input image

11
12
Figure: Processed histogram
So, that

Input image output image

Example:

13
Processed Histogram

14
Question:

Is histogram equalization always good?

Ans: No

15
16
Normalized hitogram

17
Basics of Spatial Filtering
 Filter term in “image processing” is referred to the subimage
 This sub image is called a filter, mask, kernel, template or window;
 The values in the filter sub image are referred to as coefficients rather than
pixel. Spatial filtering operations are performed directly on the pixels values
of the image
 The process consists of moving the filter mask from point to point in the image.
 The filter mask may be 3x3 mask or 5x5 mask or to be 7x7 mask.

1. Smoothing Spatial Filters [Low pass filters]:


Smoothing filters are used for blurring and noise reduction in the image.

 Blurring is pre-processing steps for removal of small details and Noise


Reduction is accomplished by blurring.
 Noise reduction can be accomplished blurring with a linear filter and also by
non-linear filtering.

18
Types of Smoothing Spatial Filter:
There are two way of smoothing special filters
1. Smoothing Linear Filters:
2. Order Statistics Filters[Non-linear]:-

1. Smoothing Linear Filter:-


 The output of a smoothing liner spatial filter is simply the average of the pixel
contained in the neighborhood of the filter mask.
 These filters are also called averaging filters or low pass filters.
 A major application of smoothing is noise reduction.

a) Averaging/mean filter:
A spatial averaging filter in which all coefficients are equal is sometimes
referred to as a “box filter”
Example:

b) Weighted averaging filter:


A weighted average filter is the one in which pixel are multiplied by different
coefficients.
Example:

19
2. Order Statistics Filter:-

Median filter
 In this filter the values of the center pixel is replaced by median of gray levels in the
neighborhood of that pixel.

 Median filters are popular because, provide excellent noise-reduction capabilities,


with less blurring than linear smoothing filters.

 These filters are particularly effective in the case of impulse or salt and pepper noise.

Example

Max filters
This filter is useful for finding the brightest points in an image.

Min filters
This filter is useful for finding the darkest points in an image.

20
Example:

21
22
23
24
Sharpening Spatial filters [high pass filter]:

 The principal objective of sharpening is to highlight fine details in an image.


 Remove blurring from images
 Highlight edges
 Useful for emphasizing transitions in image intensity
 The applications of image sharpening range from electronic printing and
medical imaging to industrial inspection and autonomous guidance in military
systems.
 As smoothing can be achieved by integration, sharpening can be achieved by
spatial differentiation.
 Thus image differentiation enhances edges and other discontinuities and
deemphasizes the areas with slow varying grey levels.

Foundation of sharpening Filters


First order derivative of a one dimensional function f(x)

The Laplacian Filter


 The second order derivative is calculated using Laplacian.
 Laplacian highlights gray-level discontinuities in an image and deemphasize
the regions of slow varying gray levels.

25
 The Laplacian for a two dimensional function f(x,y) is defined as

Where,

Now put these value in above equation

The equation can be represented using any one of the following masks

Figure: Laplacian Filter


Mathematically, it can be written as

Others different Laplacian Mask

26
Solutions:

This value add on the center pixel in given image


8 5 4
0 -8 2
1 3 7

Introduction to Frequency domain

27
In the frequency domain, a digital image is converted from spatial domain to
frequency domain. In the frequency domain, image filtering is used for image
enhancement for a specific application. A Fast Fourier transformation is a tool of the
frequency domain used to convert the spatial domain to the frequency domain. For
smoothing an image, low filter is implemented and for sharpening an image, high pass
filter is implemented. When both the filters are implemented, it is analyzed for the
ideal filter, Butterworth filter and Gaussian filter

Discrete Fourier Transform

28
Frequency Domain Filters

To filter an image in the frequency domain:

1. Image f(x,y) of size MxN


2. Multiply the input image by (-1)x+y
3. Compute F(u,v) the DFT of the image
4. Multiply f(u,v) by a filter function H(u,v)
5. Compute the inverse DFT of the result
6. Obtain the real part of result of (iv)
7. Multiply the result in (v) by (-1)x+y

29
Filters:-

Smoothing Frequency Domain Filters

 These are also called low-pass filters.


 Smoothing is achieved in the frequency domain by dropping out the high
frequency components.
 These are used to remove noice.

Types of Low Pass filters


There are three types of low pass filters
1. Ideal low pass filter [ILPF]
2. Butterworth low pass filters [BLPF]
3. Gaussian lowpass filters [GLPF]

1. Ideal Low Pass Filter [ILPF]


Low pass filters only pass the low frequencies, drop the high ones. Ideal low
pass filters simply cut off all high frequency components that are a specified
distance D0 from the origin of the transform.
The transfer function for the ideal low pass filter can be given as:

30
Where D (u, v) –distance from (u,v)
D0 – non- negative quantity

2. Butterworth low pass filters [BLPF]


 It has a parameter called the filter order.
 The transfer function of a Butterworth low pass filter (BLPF) of order n
with cut off frequency at distance Do from the origin is defined as

3. Gaussian low pass filters [GLPF]


The transfer function of a Gaussian low pass filter is

Where:
'D0- specified cut off frequency

SHARPENING FREQUENCY DOMAIN FILTERS


 These are also called High-pass filters.
 Image sharpening can be achieved by a high pass filtering process, which
attenuates(remove) the low frequency Components
 These are used to remove background of an image

Types of High-pass filters


There are three types of high pass filters
1. Ideal high pass filter
2. Butterworth high pass filters
3. Gaussian high pass filters

31
1. Ideal high pass filter
This filter is opposite of the Ideal Low Pass filter and has the transfer function of the
form

2. Butterworth high pass filters

3 Gaussian high pass filters

Homomorphic Filtering

Homomorphic filters are widely used in image processing for compensating the
effect of no uniform illumination in an image. Pixel intensities in an image
represent the light reflected from the corresponding points in the objects. As per
as image model, image f(z,y) may be characterized by two components:

(1) The amount of source light incident on the scene being viewed
(2) The amount of light reflected by the objects in the scene.
f ( x , y) = i ( x , y).r(x, y)
Taking the logarithm of the two sides
log f(x,y) = log i(x, y) + log r(x, y).
Taking Fourier transforms on both sides we get,

F[log f(x,y)} = F[log i(x, y)} + F[log r(x, y)].

32
Describe the properties of Fourier Transform
Linearity:

Scaling:

Differentiation:

Convolution:

Frequency Shift

Time Shift:

Example:

33
34
35

You might also like