0% found this document useful (0 votes)
22 views

Unit - 4 Image Enhancement (Part A)

The document discusses different techniques for enhancing digital images in the spatial domain. It describes point processing techniques like intensity transformations including linear transformations like negative and identity as well as nonlinear transformations using logarithmic and power law functions. Neighborhood processing techniques are also covered.

Uploaded by

xx69dd69xx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Unit - 4 Image Enhancement (Part A)

The document discusses different techniques for enhancing digital images in the spatial domain. It describes point processing techniques like intensity transformations including linear transformations like negative and identity as well as nonlinear transformations using logarithmic and power law functions. Neighborhood processing techniques are also covered.

Uploaded by

xx69dd69xx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

IMAGE EHANCEMENT

REFERENCE

[1] R.C Gonzalez and Richard Woods, Digital Image Processing, Pearson
Publication
Image Enhancement

• Process of manipulating image so that it becomes more suitable for a specific operation
• Enhancement techniques are problem oriented
• Method suitable for enhancement of X-ray might not be suitable for satellite images

• Improve subjective quality of an image


• Modify image so that it become appropriate for further analysis
• Making the image visually more appealing
• Enhance the otherwise hidden information
• Applications
• Noise removal, sharpening or blurring images, intensity contrast varying etc.
Image Enhancement Methods

• Spatial domain:
• Image plane itself
• Image processing methods involve manipulation directly on the pixels in the image

• Frequency/Transform Domain
• Involves transforming the image into transform domain
• Some processing done in transform domain to enhance the image
• Image converted back to spatial domain

• Histogram Processing
IMAGE EHANCEMENT- Spatial Domain

Ami Munshi
Spatial Domain Techniques

• Spatial domain:
• Image plane itself
• Image processing methods involve manipulation directly on the pixels in the
image

• As compared to Frequency (Transform) domain techniques, spatial


domain techniques are
• Computationally more efficient
• Requires less processing time
Spatial Domain Enhancement Techniques

• Spatial domain techniques can be expressed as


g(x,y)= T[f(x,y)]
Here f is the input image,
g is the output image and
T is the transformation function
• Spatial Domain Techniques
• Point processing techniques
• Neighbourhood processing techniques
Neighbourhood of point (x,y) in spatial domain

(0,0)
y • Neighbour hood is rectangular, centered on (x,y), and
much smaller in size than the original image

• Neighbourhood is moved from pixel to pixel in the


original image and operator T is applied to the pixels
(x,y) to generate the corresponding output image.

• For any specific location (x,y), the value of the output


image g at those coordinates is equal to the result of
3x3 neighbourhood of (x,y) applying T to the neighbourhood with origin at (x,y) in
f

• The procedure described above is called spatial


filtering, in which the neighbourhood along with the
predefined operation is called a spatial filter

• Type of operation performed in the neighbourhood


determines the nature of filtering process

x
Intensity or gray level transformation

(0,0)
y • Smallest possible neighbourhood size is 1X1

• In this case, g depends on the value of f at a single


point (x,y) and T becomes an intensity transformation
function
(x,y)
g(x,y)= T[f(x,y)]

3x3 neighbourhood of (x,y) Or

s= T(r)

x
Image Enhancement
Point Processing Techniques
Intensity or gray level transformation Techniques
or Point Processing Techniques

• Simple mapping operations


• New pixel at certain location depends on original pixel value at the same location and mapping
function
• No change in size, geometry or structure of new image as compared to the original image

s= T(r)

r= pixel value in the original image


s= pixel value in the new image
T= transformation function
Intensity transformation/Point Processing/Grey
Level Mapping

• Three basic types of functions used frequently for image enhancement are
• Linear point processing techniques
• Identity transformation
• Digital negative transformation

• Piece wise linear


• Thresholding
• Contrast stretching
• Grey level slicing

• Non linear
• Logarithmic transformation (Log and inverse log)
• Power law (Gamma) transformation (nth power and nth root)
Intensity level transformation techniques

• Linear
• Negative/Identity
• Logarithmic
• Log/Inverse log
• Power law
• nth power/nth root

Images taken R.C Gonzalez and Richard Woods, Digital Image


Processing, third edition (www.imageprocessingplace.com) maximum intensity level, L=255
Linear Point Transformation
-Identity Transformations

s
Output intensity is equal to input intensity
L-1
s=r

r
0 L-1

Identity Transformation
Linear Point Transformation
-Digital Negative Transformations

•Let original image have intensity levels in the


range of [0, L-1]
s
•Then in the output image, intensity value is
L-1 obtained as follows:

s= L-1-r

Here s= new image/modified image


r= original image
L= number of grey levels
L= 2n
Where n= number of bits required to represent
r each pixel
0 L-1

Digital Negative Transformation


Linear Point Transformation
-Digital Negative Transformations

Solution:

Here maximum intensity value is 7.

Therefore, n=3 → L= 8
Example: Find negative image for the given image
s= L-1-r
Digital Negative Example

g(x,y)
f(x,y)
Digital Negative Example
Non linear Point Processing technique

• Logarithmic Transformation
• Power Law Transformation
Logarithmic Transformations
• Logarithmic transformation is divided into two types:
• Log transformation
• Inverse log transformation
• The log transformation maps a narrow range of low input values into a wider range of output values
• The inverse log maps a wide range of input values into a narrow range of output values
• The formula for Logarithmic transformation is:
s = c log(r + 1)
• Here, s and r are the pixel values for input and output image. And c is constant.
• In the formula, we can see that 1 is added to each pixel value this is because if pixel intensity is zero
in the image then log(0) is infinity so, to have minimum value one is added.
• When log transformation is done dark pixels are expanded as compared to higher pixel values.
• In log transformation higher pixels are compresses.
Logarithmic Transformations
• The logarithmic operator enhances the low intensity pixel values, while compressing high
intensity values into a relatively small pixel range.
• Hence, if an image contains some important high intensity information, applying the
logarithmic operator might lead to loss of information.
• Thus, a logarithmic transform is appropriate when we want to enhance the low pixel values
at the expense of loss of information in the high pixel values. For example,
Logarithmic Transformations
• On the other hand, applying a logarithmic transform to this image is less appropriate,
because most of its details are contained in the high pixel values.
• Inverse log does opposite function to the log transformations.
• It is used to expand the values of high pixels in an image while compressing the darker-level
values.
Logarithmic Transformations
• Inverse log does opposite function to the log transformations.
• It is used to expand the values of high pixels in an image while compressing the darker-level
Logarithmic Transformations

• Any curve with general shape of log functions will accomplish spreading/compressing of intensity
levels in an image
• Important characteristic of log function is to compress dynamic range of images with large vatiation
in pixel value.
• s = c * log (1+ r)
• For r = 0 , s=0
• For r = 106
• s = log10 (1+ 106) = 6
• Range of 0 to 106 becomes 0 to 6.2 on log scale
Power Law Transformation

• It has two types of transformation nth power


transformation and nth root transformation.
• Formula: s = cr ^ γ
• Here, γ is gamma, by which this
transformation is known as gamma
transformation.
• All display devices have their own gamma
correction. That is why images are displayed
at different intensity.
Power Law Transformation

• If gamma < 1: The mapping is weighted toward brighter output values.


• If gamma = 1: The mapping is linear (Default)
• If gamma >1: The mapping is weighted toward darker output values.
Piecewise linear
-Contrast Stretching

• Simplest piecewise linear transformation


• Low contrast images due to
• Poor illumination
• sensors with less dynamic range
• wrong setting of lens aperture during
image acquisition
• Contrast stretching expands the range of
intensity levels in an image so that it spans
the full intensity range of the recording
medium or display device
Piecewise linear
-Contrast Stretching
Equation of a line
s y= mx + c
here, m= slope and c= y intercept (a constant)
L-1
C Equation for A part of the line
s2 s= mr for 0 ≤ r< r1
where, m= (s1- 0)/ (r1- 0) = s1/ r1 and c= 0
Modified Image

Equation for B part of the line


B s= m(r-r1)+ s1 for r1 ≤ r< r2
where, m= (s2-s1 )/ (r2- r1)
s1
Equation for C part of the line
s= m(r-r2)+ s2, for r2 ≤ r ≤ L-1
r where, m= (L-1-s2)/ (L-1-r2)
0 r1 r2 L-1
A Original Image
Piecewise linear
-Contrast Stretching

Example: Find the slope for all the three segments


s

L-1 r s
C
0-10 0-15
s2
10-20 15-25
Modified Image

B 20-30 25-30

s1

r
0 r1 r2 L-1
A Original Image
Piecewise linear
-Contrast Stretching

Example: Perform contrast stretching on the following image according to the transfer function shown
Piecewise linear
-Contrast Stretching

Example: Perform contrast stretching on the following image according to the transfer function shown

r1= 2, s1= 0, r2= 5, s2= 7


Piecewise linear
-Contrast Stretching

Example: Perform contrast stretching on the following image according to the transfer function shown

Equation for A part of the line r s


s= mr for 0 ≤ r< r1
where, m= (s1- 0)/ (r1- 0) = s1/ r1= 0 0

Therefore, s= 0 for all r< 2 1

Equation for B part of the line 2


s= m(r-r1)+ s1 for r1 ≤ r< r2
where, m= (s2-s1 )/ (r2- r1) = 7/3 3
s= (7/3) * (r-2) for 2 ≤ r< 5 4
Equation for C part of the line 5
r1= 2, s1= 0, r2= 5, s2= 7 s= m(r-r2)+ s2, for r2 ≤ r ≤ L-1
where, m= (L-1-s2)/ (L-1-r2)=0 6
s= 7 for all 5 ≤ r ≤ 7
7
Piecewise linear
-Contrast Stretching

Example: Perform contrast stretching on the following image using two


location points, (3,1) and (5,6)
Contrast Stretching
s
2 3 0 6 7
7
0 3 7 5 2

5 3 2 4 0 6

Modified Image
4 2 2 1 0

1 7 6 4 5
1

For the first segment, m = (1-0)/(3-0)= 0.3


r
For the second m = (6-1)/(5-3)= 2.5 0 7
3 5
For the third segment, m = (7-6)/(7-5)= 0.5
Original Image
Piecewise linear
-Contrast Stretching
Original Image

2 3 0 6 7
r s
For the first segment, m = (1-0)/(3-0)= 0.3
0 3 7 5 2
and s= m*r 0
5 3 2 4 0
For the second m = (6-1)/(5-3)= 2.5 1
4 2 2 1 0
and s= m*(r-r1) + s1
2 1 7 6 4 5
For the third segment, m = (7-6)/(7-5)= 0.5 3
Modified Image
and s= m*(r-r2) + s2
4
5
6
7
Piecewise linear
-Thresholding

Contrast Stretching
s

L-1 • Contrast stretching becomes


C Thresholding if
s2 r1 = r2
s1 = 0 and
Modified Image

B s2 = L-1

s1

r
0 r1 r2 L-1
A Original Image
Piecewise linear
-Thresholding
Thresholding
s
• Contrast stretching becomes
L-1 =s2 Thresholding if
r1 = r2
s1 = 0 and
s2 = L-1
Modified Image

For thresholding
s= L-1 for r ≥ r1
s1=0 r s= 0 for r < r1
r1=r2 L-1
Here r1 is the threshold level
Original Image
Example

s
7 • The given transformation is
applied to the image given below.
• What will be the pixel intensity at
(3,4) in the enhanced image?
Modified Image

1 1 1 2 2
3 3 3 4 4

r 4 4 1 1 1
0 3 7 2 2 5 5 2
Original Image
7 7 6 6 6
Piecewise linear
-Thresholding

• Example: Perform thresholding on the given image for r1= 4


Original Image Modified Image
r s
1 2 2 2 2
0 0
3 2 4 5 2 0 0 0 0 0
1 0 0 0 7 7 0
2 6 6 7 0
2 6 6 5 1 2 0 0 7 7 7 0

0 2 3 2 1 0 7 7 7 0
3 0
0 0 0 0 0
4 7
s= L-1 for r ≥ r1
s= 0 for r < r1 5 7

6 7
s= 7 for r ≥ 4
s= 0 for r < 4 7 7
Piecewise linear
-Grey Level Slicing/Intensity Level Slicing

• Only specific range of intensities are highlighted


• Applications include enhancing:
• Features of masses such as water body in satellite images
• Flaws in X-rays images

• Two types are:


• Intensity Level Slicing without background- Discard the background
• Intensity Level Slicing with background- Preserve the back groung
Piecewise linear
-Grey Level Slicing/Intensity Level Slicing-without
background

s
L-1

• s = s1 for r < r1

s2 • s = s2 for r1 ≤r ≤ r2
Modified Image

• s = s1 for r > r2

s1

r
s1 r1 r2 L-1
Original Image
Piecewise linear
-Grey Level Slicing/Intensity Level Slicing-with
background

s
L-1 • s = r for r < r1

s2 • s = s2 for r1 ≤r ≤ r2
• s = r for r > r2
Modified Image

s1=0 r
r1 r2 L-1
Original Image
Piecewise linear
-Grey Level Slicing/Intensity Level Slicing-without
background

• Example: Implement grey level slicing with background and without background where r1= 2
and r2= 4

Original Image • s = s1 for r < r1 Modified image with Grey


level Slicing without
• s = s2 for r1 ≤r ≤ r2 background
1 2 2 2 2
• s = s1 for r > r2 0 7 7 7 7
3 2 4 5 2
• Here s1= 0 and s2= 7 7 7 7 0 7
2 6 6 7 0
2 6 6 5 1 • s = 0 for r < r1 7 0 0 0 0

0 2 3 2 1 • s = 7 for r1 ≤r ≤ r2 7 0 0 0 0
0 7 7 7 0
• s = 0 for r > r2
Piecewise linear
-Grey Level Slicing/Intensity Level Slicing-with
background

• Example: Implement grey level slicing with background and without background where r1= 2
and r2= 4

Original Image • s = r for r < r1 Modified image with Grey


level Slicing with background
• s = s2 for r1 ≤r ≤ r2
1 2 2 2 2
• s = r for r > r2
3 2 4 5 2
2 6 6 7 0
2 6 6 5 1 • s = r for r < r1
0 2 3 2 1 • s = 7 for r1 ≤r ≤ r2
• s = r for r > r2
Original Image Grey level slicing with Grey level slicing without
background background
Grey level slicing without Grey level slicing with
Original Image
background background
Bit Plane Slicing

• Pixel values are integers composed of bits. For


example, values in a 256-level gray-scale image are
composed of 8 bits (one byte).
• Instead of highlighting intensity-level ranges, we could
highlight the contribution made to total image
appearance by specific bits.
• As Fig. Illustrates, an 8-bit image may be considered
as being composed of eight one-bit planes, with plane
1 containing the lowest-order bit of all pixels in the
image, and plane 8 all the highest-order bits.
• The binary image for the 8th bit plane of an 8-bit
image can be obtained by thresholding the input
image with a transformation function.
• This will map (0) intensity values between 0 and 127,
and will map (1) intensity values between 128 and
255.
Images taken from Gonzalez and Woods. Digital Image Processing, 3 rd Edition

Bit Plane Slicing


Original Image
Only bo of each pixel considered Only b1 of each pixel considered

Only b7 of each pixel considered


Bit Plane Slicing
Example of bit plane slicing

Original Image Binary representation

3 4 6 7 011 100 110 111


2 0 4 5 010 000 100 101
1 2 6 3 001 010 110 011
7 5 4 2 111 101 100 010

0 1 1 1 1 0 1 1 1 0 0 1
0 0 1 1 1 0 0 0 0 0 0 1
0 0 1 0 0 1 1 1 1 0 0 1
1 1 1 0 1 0 0 1 1 1 0 0

MSB Plane Middle Plane LSB Plane


Example Bit Plane Slicing (Continue)

Preserve bit planes MSB and Middle only New image

010 100 110 110 2 4 6 6


010 000 100 100 2 0 4 4
000 010 110 010 0 2 6 2
110 100 100 010 6 4 4 2
Example Bit Plane Slicing (Continue)

Calculate Root Mean Square Error (RMS) using the following formula

𝑀−1 𝑁−1
1 2
𝑟𝑚𝑠 𝑒𝑟𝑟𝑜𝑟 = ෍ ෍ 𝑠 𝑖, 𝑗 − 𝑟 𝑖, 𝑗
𝑀𝑁
𝑖=0 𝑗=0

3 4 6 7 2 4 6 6
rms error =
2 0 4 5 2 0 4 4
1 2 6 3 0 2 6 2
7 5 4 2 6 4 4 2
Original Image New image
Thank you

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy