0% found this document useful (0 votes)
60 views145 pages

Image Intensity Transformation Techniques

The document discusses intensity transformation and spatial filtering in image processing, detailing various techniques such as image negatives, log transformations, and power-law transformations. It also covers spatial filtering methods, including linear and nonlinear filters, and introduces concepts like histogram equalization and matching. Additionally, it highlights practical applications and examples of these techniques in image enhancement and analysis.

Uploaded by

rmlf366
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)
60 views145 pages

Image Intensity Transformation Techniques

The document discusses intensity transformation and spatial filtering in image processing, detailing various techniques such as image negatives, log transformations, and power-law transformations. It also covers spatial filtering methods, including linear and nonlinear filters, and introduces concepts like histogram equalization and matching. Additionally, it highlights practical applications and examples of these techniques in image enhancement and analysis.

Uploaded by

rmlf366
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

Intensity Transformation and

Spatial Filtering
2 Spatial Domain Process

g ( x, y )  T [ f ( x, y )])
f ( x, y ) : input image
g ( x, y ) : output image
T : an operator on f defined over
a neighborhood of point ( x, y)
3 Spatial Domain Process

10/14/2025
Probability
Distribution
8 Spatial Domain Process
Intensity transformation function
s  T (r )

10/14/2025
Arithmetic operations and clipping
11 Some Basic Intensity Transformation Functions

10/14/2025
12 Image Negatives

Image negatives
s  L 1  r

10/14/2025
13 Example: Image Negatives

10/14/2025
14 Log Transformations
Log Transformations
s  c log(1  r )

10/14/2025
15 Example: Log Transformations

10/14/2025
16 Power-Law (Gamma) Transformations


s  cr

10/14/2025
Example: Gamma Transformations
17

10/14/2025
Example: Gamma Transformations
18
Cathode ray tube
(CRT) devices have
an intensity-to-voltage
response that is a
power function, with
exponents varying
from approximately
1.8 to 2.5

sr 1/2.5

10/14/2025
Example: Gamma Transformations
19

10/14/2025
20 Example: Gamma Transformations

10/14/2025
21 Piecewise-Linear Transformations

 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.
output = output_start + ((output_end -
output_start) / (input_end - input_start)) * (input -
 Intensity-level
input_start) Slicing
— Highlighting a specific range of
intensities in an image often is of
interest.

10/14/2025
22

10/14/2025
Highlight the major
23 blood vessels and
study the shape of the
flow of the contrast
medium (to detect
blockages, etc.)

Measuring the actual


flow of the contrast
medium as a function of
time in a series of
images 10/14/2025
24 Bit-plane Slicing

10/14/2025
25 Bit-plane Slicing

10/14/2025
26 Bit-plane Slicing

10/14/2025
Merging two images

 M = top (mask) image, I = lower image


 E=M+I
 Multiply, E = M x I/ 255
 Screen, E = 255 – ((255 - M) x (255 - I)) / 255
 Overlay, E = (I / 255) x (I + (2xM/255) x (255 - I))
 Dodge, E = 256 x I / ((255 - M) + 1)
 Burn, E = 255 – (256 x (255- I) / (M + 1))
 For more [Link]
 [Link]
 [Link]
Assignment#1 Discussion

 Posterize: Usually values within [0,255] represent a pixel. Instead of using 256 colors, you have to use
less number of colors like 4-8. Every pixel will get the closest output color.
 Nightvision: Output R = Input G / 2, Output B = 2 x Output R, Output G = 2 x Output B
 Photocopy: Convert the input to gray level image. Then, consider a threshold = 100. If a pixel value is
greater than the threshold, put 255 as the color value in the output. Otherwise, put input pixel x
(threshold - input pixel) / (threshold^2) as the output pixel.
 Vignetting: Calculate the center pixel of the image and the maximum distance (M) possible from the
center to any corner. Then, go to each pixel and calculate the distance (D) from that pixel location to the
center. Find a darkness weight = 1 - D / M. For the output pixel, multiply the weights with the input pixel
value.
 Mirror Image: We can get the mirror image of the given image if we reverse the order of the pixels
(elements of the matrix) in each row.
Probability
Distribution
Function
(PDF)
Histogram Equalization

The intensity levels in an image may be viewed as


random variables in the interval [0, L-1].
Let pr (r ) and ps ( s) denote the probability density
function (PDF) of random variables r and s.

10/14/2025
Histogram Equalization

Discrete values:
k
sk  T (rk )  ( L  1) pr ( rj )
j 0
k nj L 1 k
 ( L  1)   nj k=0,1,..., L-1
j  0 MN MN j 0
Example: Histogram Equalization

Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096)


has the intensity distribution shown in following table.
Get the histogram equalization transformation function and give the
ps(sk) for each sk.

10/14/2025 33
Example: Histogram Equalization

0
s0  T (r0 )  7 pr (rj )  7  0.19  1.33 1
j 0
1
s1  T (r1 )  7 pr (rj )  7  (0.19  0.25)  3.08 3
j 0
s2  4.55  5 s3  5.67  6
s4  6.23  6 s5  6.65  7
s6  6.86  7 s7  7.00  7
10/14/2025 34
Example: Histogram Equalization
Histogram Matching: Discrete Cases

 Obtain pr(rj) from the input image and then obtain the values of s k,
round the value to the integer range [0, L-1].
k
( L  1) k
sk  T (rk )  ( L  1) pr (rj )   nj
j 0 MN j 0

 Use the specified PDF and obtain the transformation function


G(zq), round the value to the integer range [0, L-1].
q
G ( zq )  ( L  1) pz ( zi )  sk
i 0

 Mapping from sk to zq zq  G 1 ( sk )
10/14/2025 36
Example: Histogram Matching

Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096)


has the intensity distribution shown in the following table (on the left).
Get the histogram transformation function and make the output
image with the specified histogram, listed in the table on the right.

10/14/2025 38
Example: Histogram Matching

Obtain the scaled histogram-equalized values,

s0  1, s1  3, s2  5, s3  6, s4  7,
s5  7, s6  7, s7  7.
Compute all the values of the transformation function G,
0
G ( z0 )  7 pz ( z j )  0.00 0
j 0

G ( z1 )  0.00 0 G( z 2 )  0.00  0
G ( z3 )  1.05 1 G( z 4 )  2.45  2
G ( z5 )  4.55  5 G( z6 )  5.95  6
G ( z7 )  7.00 7

10/14/2025 39
Example: Histogram Matching

10/14/2025 40
Example: Histogram Matching

Obtain the scaled histogram-equalized values,

s0  1, s1  3, s2  5, s3  6, s4  7,
s5  7, s6  7, s7  7.
Compute all the values of the transformation function G,
0
G ( z0 )  7 pz ( z j )  0.00 0
j 0

G ( z1 )  0.00 0 G( z 2 )  0.00  0
G ( z3 )  1.05  1 s0 G( z 4 )  2.45  2 s1
G ( z5 )  4.55  5 s2 G( z6 )  5.95  6 s3
G ( z7 )  7.00 7 s 4 s 5 s6 s 7

10/14/2025 41
42 Example: Histogram Matching
s0  1, s1  3, s2  5, s3  6, s4  7, rk  zq
s5  7, s6  7, s7  7. 03
rk 1 4
0 25
1
2
36
3 47
4 57
5
6
67
7 77
Further readining: 10/14/2025
[Link]
43 Example: Histogram Matching

10/14/2025
44 Example: Histogram Matching

10/14/2025
45 Example: Histogram Matching

10/14/2025
46 Local Histogram Processing

Define a neighborhood and move its center from pixel to


pixel

At each location, the histogram of the points in the


neighborhood is computed. Either histogram equalization or
histogram specification transformation function is obtained

Map the intensity of the pixel centered in the neighborhood

Move to the next location and repeat the procedure

10/14/2025
47 Local Histogram Processing: Example

10/14/2025
48 Spatial Filtering

A spatial filter consists of (a) a neighborhood, and (b) a


predefined operation

Linear spatial filtering of an image of size MxN with a filter


of size mxn is given by the expression

a b
g ( x, y )    w(s, t ) f ( x  s, y  t )
s  a t  b

10/14/2025
a b
g ( x, y )    w(s, t ) f ( x  s, y  t )
s  a t  b
93 Spatial Filtering

10/14/2025
94 Spatial Correlation

The correlation of a filter w( x, y ) of size m  n


with an image f ( x, y ), denoted as w( x, y) f ( x, y)

a b
w( x, y ) f ( x, y )    w( s, t ) f ( x  s, y  t )
s  a t  b

10/14/2025
95 Spatial Convolution

The convolution of a filter w( x, y ) of size m  n


with an image f ( x, y ), denoted as w( x, y ) f ( x, y )

a b
w( x, y ) f ( x, y )    w( s, t ) f ( x  s, y  t )
s  a t  b

90˚ anti-clockwise 180˚

10/14/2025
96

10/14/2025
97 Smoothing Spatial Filters

Smoothing filters are used for blurring and for noise


reduction

Blurring is used in removal of small details and bridging of


small gaps in lines or curves

Smoothing spatial filters include linear filters and nonlinear


filters.

10/14/2025
98 Spatial Smoothing Linear Filters

The general implementation for filtering an M  N image


with a weighted averaging filter of size m  n is given
a b

  w(s, t ) f ( x  s, y  t )
g ( x, y )  s  a t  b
a b

  w( s, t )
s  a t  b

where m  2a  1, n  2b  1.

10/14/2025
99 Two Smoothing Averaging Filter Masks

10/14/2025
100

10/14/2025
101 Example: Gross Representation of Objects

10/14/2025
102 Order-statistic (Nonlinear) Filters

— Nonlinear

— Based on ordering (ranking) the pixels contained in the


filter mask

— Replacing the value of the center pixel with the value


determined by the ranking result

E.g., median filter, max filter, min filter

10/14/2025
103 Example: Use of Median Filtering for Noise Reduction

10/14/2025
104 Sharpening Spatial Filters

► Foundation

► Laplacian Operator

► Unsharp Masking and Highboost Filtering

► Using First-Order Derivatives for Nonlinear Image


Sharpening — The Gradient

10/14/2025
106 Sharpening Spatial Filters: Foundation

► The first-order derivative of a one-dimensional function f(x)


is the difference

f
 f ( x  1)  f ( x)
x

► The second-order derivative of f(x) as the difference

2 f
 f ( x  1)  f ( x  1)  2 f ( x)
x 2

10/14/2025
107

10/14/2025
108 Sharpening Spatial Filters: Laplace Operator

The second-order isotropic derivative operator is the


Laplacian for a function (image) f(x,y)

 2
f  2
f
 f  2  2
2

x y
2 f
 f ( x  1, y )  f ( x  1, y )  2 f ( x, y )
x 2

2 f
 f ( x, y  1)  f ( x, y  1)  2 f ( x, y )
y 2

 2 f  f ( x  1, y )  f ( x  1, y )  f ( x, y  1)  f ( x, y  1)
- 4 f ( x, y )
10/14/2025
109 Sharpening Spatial Filters: Laplace Operator

10/14/2025
110 Sharpening Spatial Filters: Laplace Operator

Image sharpening in the way of using the Laplacian:

g ( x, y )  f ( x, y )  c  2 f ( x, y ) 
where,
f ( x, y ) is input image,
g ( x, y ) is sharpenend images,
c  -1 if  2 f ( x, y ) corresponding to Fig. 3.37(a) or (b)
and c  1 if either of the other two filters is used.

10/14/2025
111

10/14/2025
112 Unsharp Masking and Highboost Filtering

► Unsharp masking
Sharpen images consists of subtracting an unsharp (smoothed)
version of an image from the original image
e.g., printing and publishing industry

► Steps
1. Blur the original image
2. Subtract the blurred image from the original
3. Add the mask to the original

10/14/2025
113 Unsharp Masking and Highboost Filtering

Let f ( x, y ) denote the blurred image, unsharp masking is


g mask ( x, y )  f ( x, y )  f ( x, y )
Then add a weighted portion of the mask back to the original
g ( x, y )  f ( x, y )  k * g mask ( x, y ) k 0

when k  1, the process is referred to as highboost filtering.

10/14/2025
114 Unsharp Masking: Demo

10/14/2025
Unsharp Masking and Highboost Filtering: Example
115

10/14/2025
Image Sharpening based on First-Order Derivatives
116

For function f ( x, y), the gradient of f at coordinates ( x, y )


is defined as
 f 
 g x   x 
f  grad( f )      
 g y   f 
 y 

The magnitude of vector f , denoted as M ( x, y )


Gradient M ( x, y )  mag(f )  g x 2  g y 2
Image
10/14/2025
Image Sharpening based on First-Order Derivatives

The magnitude of vector f , denoted as M ( x, y )


M ( x, y )  mag(f )  g x 2  g y 2

M ( x, y ) | g x |  | g y |

z1 z2 z3
M ( x, y ) | z8  z5 |  | z6  z5 |
z4 z5 z6
z7 z8 z9
10/14/2025 117
Image Sharpening based on First-Order Derivatives

Roberts Cross-gradient Operators


M ( x, y ) | z9  z5 |  | z8  z6 |

Sobel Operators
M ( x, y ) | ( z7  2 z8  z9 )  ( z1  2 z2  z3 ) |
z1 z2 z3  | ( z3  2 z6  z9 )  ( z1  2 z4  z7 ) |
z4 z5 z6
z7 z8 z9
10/14/2025 118
Image Sharpening based on First-Order Derivatives

10/14/2025 119
Example

10/14/2025 120
Example:

Combining
Spatial
Enhancement
Methods

Goal:

Enhance the
image by
sharpening it
and by bringing
out more of the
skeletal detail

10/14/2025 121
Blurring masks

A blurring mask has the following properties.


• All the values in blurring masks are positive
• The sum of all the values is equal to 1
• The edge content is reduced by using a blurring mask
• As the size of the mask grow, more smoothing effect will take place

Derivative masks
A derivative mask has the following properties.
• A derivative mask have positive and as well as negative values
• The sum of all the values in a derivative mask is equal to zero
• The edge content is increased by a derivative mask
• As the size of the mask grows , more edge content is increased

• Blurring masks are also called as low pass filter


• Derivative masks are also called as high pass filter
Gaussian Smoothing/Blur

The Gaussian distribution in 1-D has the form: In 2-D, an isotropic (i.e. circularly symmetric) Gaussian has the form:
124 Set and Logical Operations

Weeks 1 & 2
Set and Logical Operations

125
Set and Logical Operations

 Let A be the elements of a gray-scale image


The elements of A are triplets of the form (x, y, z), where x
and y are spatial coordinates and z denotes the intensity at
the point (x, y).
A  {( x, y, z ) | z  f ( x, y )}

 The complement of A is denoted Ac


Ac  {( x, y, K  z ) | ( x, y, z )  A}
K  2k  1; k is the number of intensity bits used to represent z

126
Set and Logical Operations

 The union of two gray-scale images (sets) A and B is


defined as the set

A  B  {max(a, b) | a  A, b  B}
z

127
Set and Logical Operations

128
Geometric Spatial Transformations

 Geometric transformation (rubber-sheet transformation)


— A spatial transformation of coordinates

— intensity interpolation that assigns intensity values to the spatially transformed pixels.

 Affine transform

129
130
Intensity Assignment

 Forward Mapping: scanning the pixels of the input image and, at each location ( x, y)
computing the spatial location (x’ , y’)of the corresponding pixel in the output image

It’s possible that two or more pixels can be transformed to the same location in the
output image.

 Inverse Mapping

The nearest input pixels to determine the intensity of the output pixel value.
Inverse mappings are more efficient to implement than forward mappings.

131
132 Example: Image Rotation and Intensity
Interpolation

Weeks 1 & 2
133 Image Registration

 Input and output images are available but the transformation


function is unknown.
Goal: estimate the transformation function and use it to
register the two images.

 One of the principal approaches for image registration is to


use tie points (also called control points)
 The corresponding points are known precisely in the input
and output (reference) images.

Weeks 1 & 2
134 Image Registration

Weeks 1 & 2
135 Image Registration

 A simple model based on bilinear approximation:


 x  c1v  c2 w  c3vw  c4

 y  c5v  c6 w  c7 vw  c8

Where (v, w) and ( x, y ) are the coordinates of


tie points in the input and reference images.

Weeks 1 & 2
Color space: RGB

 A color space is a specific organization of colors.


 In combination with color profiling supported by
various physical devices, it supports reproducible
representations of color -- whether such
representation entails an analog or a digital
representation.
HSI Color space
 The Hue, which can be defined rate of
pure color, is an angle form between 0°
and
360°. Red, Green, Blue are 0°, 120°, and
360°, and Yellow, Cyan, and Magenta are
60°, 180°, 300°.
 The Saturation, which shows how the color
to be pure, takes value between [0, 1].
 The intensity is the dimensions of
lightness or darkness. The range of
intensity is between 0 (black)
and 1 (white).
YIQ Color space

 YIQ, which is defined by the National Television System Committee


(NTSC), produces the luminance and the chrominance.
 The Y component represents the luma information, and is the only
component used by black-and-white television receivers. I and Q
represent the chrominance information.
Noise

 We may define noise to be any degradation in the image signal, caused


by external disturbance.
 If an image is being sent electronically from one place to another, via
satellite or wireless transmission, or through networked cable, we may
expect errors to occur in the image signal. These errors will appear on
the image output in different ways depending on the type of disturbance
in the signal.
 Cleaning an image corrupted by noise is thus an important area of
image restoration
Salt and pepper noise

 Also called impulse noise, shot


noise, or binary noise.
 This degradation can be caused
by sharp, sudden disturbances in
the image signal; its appearance
is randomly scattered white or
black (or both) pixels over the
image.
Gaussian noise

 Gaussian noise is an idealized form of white noise,


which is caused by random fluctuations in the
signal.
 We can observe white noise by watching a television
which is slightly mistuned to a particular
channel. Gaussian noise is white noise which is normally
distributed.
 If the image is represented as ‘I’ and the Gaussian
noise, ‘N’ by then we can model a noisy image by
simply adding the two:
noisy image = I + N
Speckle noise
 Whereas Gaussian noise can be modelled by random values added to an
image; speckle noise (or more simply just speckle) can be modelled by
random values multiplied by pixel values, hence it is also called
multiplicative noise.

noisy image = I (1+ N)


Periodic noise
 If the image signal is subject to a periodic, rather than a random
disturbance, we might obtain an image corrupted by periodic noise.
 The effect is of bars over the image.
Noise cleaning/removal
 Average filtering
 Median filtering
 Rank-order filtering
 Rather than take the median of a set, we order the set and take the -th
value, for some predetermined value of .
 Outlier method

 Image averaging

You might also like