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

Week 4 - L2

The document discusses spatial operations in image processing, focusing on intensity transformation and spatial filtering techniques. It covers image registration using tie points, various intensity transformation methods like contrast stretching, thresholding, and logarithmic transformations, as well as spatial filtering principles. The lecture emphasizes the importance of manipulating pixel values for enhancing image quality and achieving desired visual outcomes.

Uploaded by

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

Week 4 - L2

The document discusses spatial operations in image processing, focusing on intensity transformation and spatial filtering techniques. It covers image registration using tie points, various intensity transformation methods like contrast stretching, thresholding, and logarithmic transformations, as well as spatial filtering principles. The lecture emphasizes the importance of manipulating pixel values for enhancing image quality and achieving desired visual outcomes.

Uploaded by

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

CS389 – Image Processing

Week 4 - Lecture 2
Spatial Operations (Pt. 2)
Intensity Transformation and Spatial Filtering

Dr. Mohamed Nagy Saad


Associate Professor
Faculty of Computer Science
October University for Modern Sciences and Arts
(MSA University)
Fall 2024
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.

2
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.

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

Advantages: • Easy to implement


• More efficient computationally
• Require less processing resources to implement
Spatial Filtering

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).

=𝟏 𝑻 → 𝑔𝑟𝑎𝑦 𝑙𝑒𝑣𝑒𝑙 𝑜𝑟 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦


• T can operate on one or many images of any shape of neighborhoods (Ns).

So, if size(N) { >×𝟏𝟏×𝟏


𝑡𝑟𝑎𝑛𝑠𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛
𝑻 → 𝑠𝑝𝑎𝑡𝑖𝑎𝑙
• Type of operation (T) on Ns determines 𝑓𝑖𝑙𝑡𝑒𝑟𝑖𝑛𝑔
the nature of filtering process.
• Spatial filter = spatial mask = kernel = template = window
Spatial Domain Process
Intensity transformation function
s T ( r )

11
1- Contrast stretching
Transformation

Original Image Stretched Image

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

Original Image Binary Image

Thresholding means  produce two-level/two color image


-Image
Enhancement
Image enhancement: is the process of manipulating an image so that the result
is more suitable than the original for a specific application (e.g.. method used to
enhance x-ray images may not be the best approach for enhancing satellite images
taken in the infrared band of electromagnetic spectrum).

Image enhancement functions types


Linear function Logarithmic function Power-law function
- Negative -Log - Nth power
- Identity - Inverse Log - Nth root
Some basic gray-level transformation functions used for image enhancement.

where, for simplicity in notation

r  gray level of f(x, y) , I/P S 


g(x, y) at any point (x, y). O/P
Image Negatives

Image negatives
s L  1  r

17
3- Image
Negatives

where, for simplicity in notation

r  gray level of f(x, y) ,


Original Image Negative Image I/P S  is the negative
image O/P L  no. of gray levels
allowed
Note
the visual content is the same in both I/P & O/P images.

• It’s reverse the levels of the image


• Suited for enhancing white or gray detail embedded in dark regions of an image, specially when the dark or black
areas are dominant in size.
Example: 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

4- Log Why (1+r) ? if r=0 then, log(0)=∞

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

& 𝜸 = 𝟎. & 𝜸 = 𝟐. &𝜸 =


Original Image C=1
& 𝜸 = 𝟎.
C=1 C=1 C=1

𝟒 𝟏 𝟓 𝟏𝟎
• 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

& 𝜸 = 𝟎. & 𝜸 = 𝟎. & 𝜸 = 𝟎. & 𝜸 = 𝟎.


Original Image C=1 C=1 C=1 C=1

𝟔 𝟑 𝟐 𝟒

Note As 𝜸 < 𝟏 increasing  the brightness of image will be increased.


Another
Example

&𝜸 &𝜸
C=1 C=1
&𝜸
Original Image C=1

=𝟑 =𝟒 =𝟓

Note As 𝜸 > 𝟏 increasing  the darkness of image will be increased.


Advantages of
power-law
A variety of devices used for image capture, printing, & display respond according to the power law.

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).

Piecewise-Linear Transformation functions:  Contrast Stretching


 Intensity/gray-Level Slicing
 Bit-Plane Slicing.
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.

• 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

You might also like