Week 4 - L2
Week 4 - L2
Week 4 - Lecture 2
Spatial Operations (Pt. 2)
Intensity Transformation and Spatial Filtering
2
Image Registration
x c1v c2 w c3vw c4
y c5v c6 w c7 vw c8
3
Image Registration
4
Spatial Domain vs. Transform Domain
• Spatial domain
image plane itself, directly process the intensity values of the image plane
• Transform domain
process the transform coefficients, not directly process the intensity values of the
image plane
5
Conte
nt
•
•
Introduction to spatial domain processing
Spatial Domain Processing
Intensity/Point transformation
Contrast Stretching transformation.
Image Thresholding.
Image Negatives.
Log Transformation.
Power-Law ( Gamma ) Transformation.
Piecewise-Linear Transformation functions.
Histogram (next lecture).
Spatial filtering
Introducti
on Domain Processing Direct Manipulation of pixels in an image.
Spatial
Spatial Domain Processing
Intensity/Point Transformation Spatial filtering
Operate on single pixel. Operate on neighborhood of every
pixel.
Examples: Examples:
• Contrast Manipulation • Image smoothing
• Image Thresholding • Image sharpening
• Image Enhancement
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)
8
Spatial Filtering
9
-
Backgrou
Spatial domain processes will be denoted by the
nd
expression:
Notes
• where f(x, y) is the input image, g(x, y) is the processed image, and T is an operator on f, defined over some
neighborhood of (x, y).
11
1- Contrast stretching
Transformation
Brief Description
Contrast stretching (often called normalization) is a simple image enhancement technique that attempts to
improve the contrast in an image by `stretching' the range of intensity values it contains to span a desired range of
values, e.g. the full range of pixel values that the image type concerned allows.
It differs from the more sophisticated histogram equalization in that it can only apply a linear scaling function to the
image pixel values
2- Image
Thresholding
Contrast Stretching functions 𝑠 = 𝑇 (𝑟) = 1/(1+(m/r).^E)
𝑠 = 𝑇 (𝑟) = 1/(1+(m/(r+0.01)).^E As E increases --------> thresholding
2- Image
Thresholding
Image negatives
s L 1 r
17
3- Image
Negatives
Small
lesion
19
Log Transformations
Log Transformations
s c log(1 r )
20
Example: Log Transformations
21
S= C* log(1+r);
r assumed to be ≥ 0
C constant
Transformation
Original Image When C=1 When C=6 When C=-6 When C=0.5
• Log transformation maps a narrow range of low intensity values in the I/P into a wider range of O/P levels. The
opposite is true for higher values of I/P levels.
• Suited for: expanding the values of dark pixels in an image while compressing the higher-level values.
The opposite is true for Inverse log.
Note:
The important characteristic of the log transform is that it compress the dynamic range of images with large variations
in pixel value.
Power-Law (Gamma) Transformations
s cr
23
(Gamma 𝜸)
5- Power-Law r assumed to be ≥ 0
C positive constant
𝟒 𝟏 𝟓 𝟏𝟎
• Gamma transformation maps a narrow range of dark values in the I/P into a wider range of O/P levels. The opposite
is true for higher values of I/P levels.
Note:
With a values of C = 1 & 𝜸 < 1 → the effect is similar to Log Transformation .
With a values of C = 1 & 𝜸 = 1 → the effect is similar to Identity Transformation .
With a values of C = 1 & 𝜸 > 1 → the effect is similar to Inverse − Log Transformation .
Another
Example
𝟔 𝟑 𝟐 𝟒
&𝜸 &𝜸
C=1 C=1
&𝜸
Original Image C=1
=𝟑 =𝟒 =𝟓
How?
If the monitor displays the image with a factor of error of 𝜸 = 𝟐. 𝟓 then, the input image should
be pre-processed with a value 𝜸 = 𝟎. 𝟒, where it has the opposite effect of the error of the
monitor.
Advantages of
power-law
Example of power transformation: Gamma correction
Advantages of
power-law
Example of power transformation: Gamma correction
To correct for this, apply the power transformation
I = I.^(1/ɤ) Digital cameras apply this correction operation.
Example: Gamma Transformations
30
Example: Gamma Transformations
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
31
5- Piecewise-Linear
Transformation
Piecewise:
In mathematics, a piecewise-defined function (also called a piecewise function or a
hybrid function) is a function which is defined by multiple sub-functions, each sub-
function applying to a certain interval of the main function's domain (a sub-domain).
• 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.
• Intensity-level Slicing
— Highlighting a specific range of intensities in an image often is of interest.
33
Contrast
Stretching
Contrast Vs. Brightness
Low contrast images occur often due to :
Contrast poor or non-uniform lightning conditions
small dynamic range of imaging sensors
Stretching
The aim of contrast stretching is to enhance the contrast of the images by making the dark
portions darker and making bright portions brighter.
In order to make regions dark one can choose slope of less than 1, to make regions brighter one
can choose slope of greater than 1.
A function can expressed as:
𝑚 𝟎≤𝒓<𝑨
𝑟 𝑨≤𝒓<𝑩
𝑆= 𝑨≤𝒓<𝑳
{𝑛 𝑟 −𝟏
Where m, n,𝑘 &𝑟 k is the slope of the line of each
range
36