0% found this document useful (0 votes)
24 views169 pages

Dip 1

Uploaded by

Saksham Jain
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)
24 views169 pages

Dip 1

Uploaded by

Saksham Jain
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/ 169

MIT WPU,Pune

T.Y.B.Tech
Semester-6
A.Y. 2023-24

Digital Image Processing(ECE3013B)


(PE-2)
Class Continuous Assessment (CCA-30 Marks)
Assignment 10
Midterm Test 15
Objective Test (All Units) 5
Total 30
Lab Continuous Assessment (LCA-30 Marks)
Lab Manual Submission & Simulation 10
Understanding
Midterm Pr Exam 10

PBL 10
Total 30
End Term Exam 40

Total 100
Unit 1
Fundamentals of Image Processing

Unit Topic
Topic Description
Name Name
Steps in Image processing, Human visual system, Image Sensing
And Acquisition, Pixels
Light, Brightness adaption and discrimination Sampling &
quantization
Fundame
ntals of Representing digital images, spatial and grey level resolution,
Image
UNIT-I Processi Image file formats, Basic relationships between pixels
ng
Distance Measures, Performance Measures for Image Quality.
Geometric Transformation
Distance Measures, Performance Measures for Image Quality
Examples / Revision
Teaching Scheme: Lecture : 04 hrs/week
Course Objectives:

1. Understand the fundamentals of Digital Image


Processing with the basic relationship of pixels and
mathematical operations on 2-D data
2. Learn the concepts of image enhancement in
spatial and frequency domain
3. Understand the concepts of image compression and
restoration
4. Understand and apply the concepts of object
segmentation and analysis.
Course Outcomes

After completion of this course, students will be able to


1. Implement basic mathematical operations on digital
images (CL III)
2. Analyze and solve image enhancement & filtering
(CL IV)
3. Apply 2-D data compression techniques and
restoration for digital images (CL III)
4. Identify and design image processing techniques for
object segmentation and analysis
(CL IV)
Practicals
(
1. Create synthetic images using arrays, to read and display an
image, perform basic arithmetic / logical operations on
digital images, and image resizing / flipping.
2. To plot the histogram and perform histogram equalization.
3. To perform image smoothing using spatial domain filters.
4. Perform image filtering in the frequency domain
5. To perform image compression using DCT/wavelet
transform
6. Apply morphological operators on an image.
7. To perform edge detection using various masks in the spatial
domain
8. To perform global and adaptive thresholding
9. PBL /Miniproject based on Digital image processing
Books

Reference Books:
1. Rafael C. Gonzalez and Richard E. Woods, “Digital Image
Processing”, Fourth Edition, -Pearson Education.
2. S Sridhar, “Digital Image Processing”, Oxford University
Press.
3. Pratt William K. "Digital Image Processing", John Wiley
& sons, Fourth Edition,Wiley
Syllabus Mapping with Book
T1:Rafael C. Gonzalez and Richard E. Woods, “Digital Image Processing”, Third
Edition, - Pearson Education
Additional:S Sridhar, “Digital Image Processing”, Oxford University Press

Sr. No. Contents Mapping

1 Steps in Image processing(1) T1- Chapter No. 1(25-28)

2 Human visual system(15 mins) T1- Chapter No. 2 (36-44)

3 Sampling & quantization, Representing digital images, T1- Chapter No. 2(52-65
spatial and gray level resolution(1 hr)

4 Image file formats(15 mins) Additional:Pg-61

5 Basic relationships between pixels, Distance Measures(1 hr) T1- Chapter No. 2(68-72)

6 Basic operations on images image addition, subtraction, T1- Chapter No. 2(72-95)
logical operations, scaling translation, rotation.(1 hr)

7 Color fundamentals and models RGB, HIS, YIQ(1/2 hr) T1- Chapter No. 6(394-413)

8
Introduction and Digital Image Fundamentals

Digital image processing is the study of representation


and manipulation of pictorial information by a
computer.
Improve pictorial information for better clarity
(human interpretation)
Examples:
1 Enhancing the edges of an image to make it appear
sharper
2 Remove “noise” from an image
3 Remove motion blur from an image
History of Digital Image Processing

Early 1920s: One of the first


applications of digital imaging was in
the news-paper industry
-The Bartlane cable picture transmission
service
-Images were transferred by submarine
Early digital image
cable between London and New York
-Pictures were coded for cable transfer
and reconstructed at the receiving end
on a telegraph printer
History of DIP
Mid to late 1920s:
Improvements to the
Bartlane system resulted in Improved
higher quality images digital image

-New reproduction
processes based
on photographic
techniques.
-Increased number
of tones in reproduced Early 15 tone digital image
images
History of DIP
1960s: Improvements in
computing technology and the
onset of the space race led to a
surge of work in digital image
processing
1964: Computers used to
improve the quality of images of A picture of the moon
taken by the Ranger 7
the moon taken by the Ranger 7 probe minutes before
probe ,Such techniques were used landing

in other space missions including


the Apollo landings.
History of DIP
1970s: Digital image
processing begins to be used
in medical applications
1979: Sir Godfrey N.
Hounsfield & Prof. Allan M.
Cormack share the Nobel
Prize in medicine for the Typical head slice CAT image
invention of tomography, the
technology behind
computerised Axial
Tomography (CAT) scans
History of DIP

1980s - Today: The use of digital image


processing techniques has exploded and
they are now used for all kinds of tasks in
all kinds of areas
-Image enhancement/restoration
-Artistic effects
-Medical visualisation
-Industrial inspection
-Law enforcement
-Human computer interfaces
Examples: Image Enhancement
One of the most common uses of DIP techniques:
improve quality, remove noise etc
Examples: The Hubble Telescope

Launched in 1990 the Hubble


telescope can take images of
very distant objects
However, an incorrect mirror
made many of Hubble’s
images useless
Image processing
techniques were
used to fix this
Examples: Artistic Effects
Artistic effects are
used to make images
more visually
appealing, to add
special effects and to
make composite
images
Examples: Medicine

Take slice from MRI scan of canine heart, and find boundaries between
types of tissue
Image with gray levels representing tissue
density
Use a suitable filter to highlight edges

Original MRI Image of a Dog Heart


Edge Detection Image
Examples: GIS

Geographic Information Systems


Digital image processing techniques are used extensively
to manipulate satellite imagery
Terrain classification
Meteorology
Examples: GIS

Night-Time Lights of the


World data set
Global inventory of human
settlement
Not hard to imagine the
kind of analysis that might
be done using this data
Examples: Industrial Inspection

Human operators are


expensive, slow and
unreliable
Make machines do the job
instead
Industrial vision systems
are used in all kinds of
industries
Examples: PCB Inspection
Printed Circuit Board (PCB) inspection
Machine inspection is used to determine that all
components are present and that all solder joints are
acceptable
Both conventional imaging and x-ray imaging are used
Examples: Law Enforcement
-Image processing
techniques are used
extensively by law
enforcers
-Number plate
recognition for speed
cameras/automated
toll systems
-Fingerprint
recognition
-Enhancement of
CCTV images
Examples: HCI

-Try to make human computer


interfaces more natural
Face recognition,
Gesture recognition
-These tasks can be extremely
difficult
Visual Perception: Human Eye

(Picture from Microsoft Encarta 2000)


Visual Perception: Human Eye

(Picture from Microsoft Encarta 2000)


Visual Perception: Human Eye (cont.)
1. The lens contains 60-70% water, 6% of fat.

2. The iris diaphragm controls amount of light that enters the eye.
3. Light receptors in the retina
- About 6-7 millions cones for bright light vision called
photopic
- Density of cones is about 150,000 elements/mm2.
- Cones involve in color vision.
- Cones are concentrated in fovea about 1.5x1.5 mm2.
- About 75-150 millions rods for dim light vision called scotopic
- Rods are sensitive to low level of light and are not involved
color vision.
4. Blind spot is the region of emergence of the optic nerve from the
eye.
Distribution of Rods and Cones in the Retina

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Image Formation in the Human Eye

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.

(Picture from Microsoft Encarta 2000)


Ex: Consider an
observer looking at
the lamp post which is 10
at distance of 50m.If m
the height of the lamp
post is 10m,Find the 50 17m
size of the image m m
formed in the
retina(Retinal Image)
10 r
= 17
50
r=3.4mm=Height of the retinal Image
If the same image is observed at a distance of 100m,we get
10 r
= 17
100
r=1.7mm=Height of the retinal Image
Brightness Adaptation of Human Eye : Mach Band
Effect
Intensity

Position
Mach Band Effect
Intensities of
surrounding points
effect perceived
brightness at each
point.

In this image, edges


between bars appear
brighter on the right
side and darker on the
left side.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Mach Band Effect (Cont)

B A
Intensit
y

Position
In area A, brightness perceived is darker while in area B is
brighter. This phenomenon is called Mach Band Effect.
Image Formation
A digital image is a representation of a
two-dimensional image as a finite set of digital values,
called picture elements or pixels

f(x,y) = reflectance(x,y) * illumination(x,y)


Reflectance in [0,1], illumination in [0,inf]
Sampling and Quantization
Sampling and Quantization
What is Light
The visible portion of the electromagnetic (EM)
spectrum.
It occurs between wavelengths of approximately
400 and 700 nanometers.
Key steps in Digital Image Processing

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Knowledge Base Representati


Image
on &
Acquisition
Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Acquisition

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representati
Image
on &
Acquisition
Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Image Acquisition
Key Stages in Digital Image Processing:
Image Enhancement

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representatio
Image
n&
Acquisition
Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Image Enhancement
Key Stages in Digital Image Processing:
Image Restoration

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representatio
Image
n&
Acquisition
Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Image Restoration

It is the process of removal or reduction of


degradation in an image through
linear or non linear filtering.
Key Stages in Digital Image Processing:
Morphological Processing

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representatio
Problem Domain n&
Description
Color Image Image
Processing Compression
Morphological Processing
Key Stages in Digital Image Processing:
Segmentation

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representatio
Image
n&
Acquisition
Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Segmentation
Key Stages in Digital Image Processing:
Representation & Description

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Representation
Acquisition & Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Representation & Description
Key Stages in Digital Image Processing:
Object Recognition

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Object Recognition
Key Stages in Digital Image Processing:
Image Compression

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Image Compression
Key Stages in Digital Image Processing:
Colour Image Processing

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Colour Image Processing
Fundamentals of Digital Images
Fundamentals of Digital Images
Image Coordinate system
Fundamentals of Digital Images
x

Origin

y
Image “After snow storm”
f(x,y)
⬥ An image: a multidimensional function of spatial coordinates.
⬥ Spatial coordinate: (x, y) for 2D case such as photograph,
(x, y, t) for movies
⬥ The function f may represent intensity (for monochrome images)
or color (for color images) or other associated values.
What is a Digital Image? (cont…)
Pixel values typically represent gray levels,
colors, distance from camera, etc.
Remember digitization implies that a digital
image is an approximation of a real scene

1 pixel
Digital Image Representation
Representation of Digital Image

0 1 2 3 4 5 6 7

0 6 6 7 0 1
7 6 5 0 1 5
7 4 1 1 5 1
6 6 5 1 0 7
4 1 1 2 2 5
Binary Image

1 1 1 1 1 1
1 0 0 0 0 1
1 1 0 0 1 1
1 1 0 0 1 1
0 1 1 1 1 0
Image Types : Binary Image

Binary image or black and white image


Each pixel contains one bit :
1 represent white
0 represents black

Binary data
Digital Image Types : Intensity Image

Intensity image or monochrome image


each pixel corresponds to light intensity
normally represented in gray scale (gray
level).

Gray scale values


Digital Image Types : RGB Image

Color image or RGB image:


each pixel contains a vector
representing red, green and
blue components.

RGB components
Gray Level and Color Images
1. Binary Image 2.Gray Scale Image 3. Color Image

2 Colors 256 Gray Shades 16,777,216 colors

Color resolution/ color depth/ levels:


- No. of colors or gray levels or
- No. of bits representing each pixel
value
- No. of colors or gray levels Nc is given
by
where b = no. of bits
A Gray Level Image is a Matrix
f(0,0) f(0,1) f(0,2) …. …. f(0,n-1)
f(1,0) f(1,1) f(1,2) …. …. f(1,n-1)
. . .
. . .
. . .
f(m-1,0) f(m-1,1) f(m-1,2) … …. f(m-1,n-1)

An image of m rows, n columns, f(i,j) is in [0,255]


Gray and Color Image Data
• 0, 64, 144, 196,
225, 169, 100, 36

(R, G, B) for a color pixel


Red – (255, 0, 0)
Green – ( 0, 255, 0)
Blue – ( 0, 0, 255)
Cyan – ( 0,255, 255)
Magenta – (255, 0, 255)
Yellow – (255, 255, 0)
Gray – (128, 128, 128)
How to choose the spatial resolution
Spatial = Sampling locations
resolution
Original image
Sampled image

Under sampling, we lost some image details!


How to choose the spatial resolution : Nyquist Rate
Original image

Sampled image

1m
m
2m
m

No detail is lost!
Minimum Nyquist Rate:
Spatial
Period Spatial resolution must be less or
resolution
(sampling rate) equal
half of the minimum period of the
= Sampling locations
image
or sampling frequency must be greater
Effect of Spatial Resolution

256x256 pixels 128x128 pixels

64x64 pixels 32x32 pixels


Effect of Spatial Resolution
Effect of Spatial Resolution
1024x1024 512 x 512 256 x 256

128 x 128 32 x 32
64 x 64
Image Quantization
Image quantization:
discretize continuous pixel values into
discrete numbers

Color resolution/ color depth/ levels:


- No. of colors or gray levels or
- No. of bits representing each pixel value
- No. of colors or gray levels Nc is given by

where b = no. of bits


Quantization function

Nc-1

Nc-2
Quantization level

1
0
Light intensity
Darkest Brightest
Intensity Level Resolution
Intensity level resolution refers to the number of intensity
levels used to represent the image
The more intensity levels used, the finer the level of
detail discernable in an image
Intensity level resolution is usually given in terms of
the number of bits used to store each intensity level
Number of Bits Number of Intensity Examples
Levels(Gray
Shades)
1 2 0, 1
2 4 00,01,10,11
4 16 0000,0101,…,1111
8 256 00110011,…, 01010101
16 65,536 1010101010101010
Effect of Quantization Levels

256 levels 128 levels

64 levels 32 levels
Effect of Quantization Levels (cont.)

16 levels 8 levels

In this image,
it is easy to see
false contour.

4 levels 2 levels
Zooming and shrinking
Resolution :How much is enough
Common image file formats

PGM (Portable Gray Map)


BMP (Bit Map File)
PNG (Portable Network Graphics)
GIF (Graphic Interchange Format) –
JPEG (Joint Photographic Experts Group)
TIFF (Tagged Image File Format)
FITS (Flexible Image Transport System)
Basic Relationship of Pixels
(0,0) x OR

(x-1,y-1) (x,y-1) (x+1,y-1) (x-1,y-1) (x-1,y) (x-1,y+1)

(x-1,y) (x,y) (x+1,y) (x ,y-1) (x,y) (x,y+1)


y

(x-1,y+1) (x,y+1) (x+1,y+1) (x+1,y-1) (x+1,y) (x+1,y+1)

Conventional indexing method


Neighbors of a Pixel

Neighborhood relation is
used to tell adjacent pixels. It is
(x,y-1) useful for analyzing regions.

(x-1,y) p (x+1,y) 4-neighbors of p:


(x-1,y)
(x+1,y)
(x,y+1)
N4(p) = (x,y-1)
(x,y+1)
4-neighborhood relation considers only vertical and
horizontal neighbors.

Note: q Î N4(p) implies p Î N4(q)


Neighbors of a Pixel (cont.)

(x-1,y-1) (x+1,y-1) Diagonal neighbors of p:


p
(x-1,y-1)
(x+1,y-1)
ND(p) = (x-1,y+1)
(x-1,y+1) (x+1,y+1) (x+1,y+1)

Diagonal -neighborhood relation considers only diagonal


neighbor pixels.
Neighbors of a Pixel (cont.)

(x-1,y-1) (x,y-1) (x+1,y-1)


8-neighbors of p:N8(p)=N4(p) U ND(p)
(x-1,y) p (x+1,y) (x−1,y−1)
(x,y−1)
(x-1,y+1) (x,y+1) (x+1,y+1)
(x+1,y−1)
(x−1,y)
(x+1,y)
N8(p) = (x−1,y+1)
(x,y+1)
(x+1,y+1)

8-neighborhood relation considers all neighbor pixels.


Distance Measures
1.Euclidean distance
2.D4-distance (city-block distance)
3.D8-distance (chessboard distance)
Distance Measures
1. Euclidean distance
For pixel p, q, and z with coordinates (x, y), (s, t) and (u,
v),
D is a distance function or metric if

• D(p, q) ≥ 0 (D(p, q) = 0 if and only if p = q)

• D(p, q) = D(q, p)

D(p, z) ≤Euclidean
• Example: D(p, q) +distance
D(q, z)
Distance (cont.)
2. D4-distance (city-block distance)
D4-distance (city-block distance) is defined as

2 1 2

2 1 0 1 2

2 1 2

Pixels with D4(p) = 1 is 4-neighbors of p.


Distance (cont.)

3. D8-distance (chessboard distance)


D8-distance (chessboard distance) is defined as

2 2 2 2 2

2 1 1 1 2

2 1 0 1 2

2 1 1 1 2

2 2 2 2 2

Pixels with D8(p) = 1 is 8-neighbors of p.


Distance Measures
1 2 3

1 q
2 p
3

Ex:Compute the distance between the two


pixels using the three distances :
q:(1,1)
P: (2,2)
Euclidian distance : ((1-2)2+(1-2)2)1/2 = sqrt(2).
D4(City Block distance): |1-2| +|1-2| =2
D8(chessboard distance ) : max(|1-2|,|1-2|)= 1
(because it is one of the 8-neighbors )
Example :
Use the city block distance to prove
a(2,1) p(2,2)
4-neighbors ? B(3,2) p(2,2)
C(2,3) P(2,2)
D(1,2) P(2,2)
Pixel A : | 2-2| + |1-2| = 1
Pixel B: | 3-2|+|2-2|= 1
1 2 3
Pixel C: |2-2|+|2-3| =1 1
2 d
Pixel D: |1-2| + |2-2| = 1
3
c p a
b
Now as a homework try
1 2 3
the chessboard distance 1
2 f d e
to proof the 8- 3
c p a
neighbors!!!! h b g
Connectivity
Connectivity is an important concept to find the
region property of an image or the property of a
particular region within the image.
It is used for
Establishing object boundaries
Defining image components/regions etc
Connectivity Image size=MxNxk-bits

V: set of gray level values (L), (V is a subset of L.)

3 types of adjacency
❑ 4- adjacency: 2 pixels p and q with values from V are 4- adjacent if q is in
the set N4(p)
❑ 8- adjacency: 2 pixels p and q with values from V are 8- adjacent if q is in
the set N8(p)
❑ m- adjacency: 2 pixels p and q with values from V are m adjacent if
1. q is in N4(p), or
2. q is in ND(p) and the set N4(p) ∩ N4(q) has no pixels whose
values are from V
Connectivity
For p and q from the same class
• 4-connectivity: p and q are 4-connected p, q ∈ V & q ∈N4(p)

• 8-connectivity: p and q are 8-connected p,q ∈ V & q ∈ N8(p)


• mixed-connectivity (m-connectivity):
p and q are m-connected if q ∈ N4(p) or
q ∈ ND(p) and N4(p) ∩ N4(q) = Φ

Either q has to be a 4 neighbor of p or p has to be a 4 neighbor of q


Or q has to be a diagonal neighbor of p, but at the same time N4 (p)
intersection with N4(q) must be equal to Φ,
Connectivity

N4(p) ∩ N4(q)
this indicates the set of points which are 4 neighbors
of both the points p and q

If the point q belongs to the diagonal neighbor of p and


there is a common set of points which have 4
neighbors to both the points p and q then M
connectivity is not valid
Ex: V={1}
0 1 1 0 1 1 0 1 1
0 1 0 1 0 1 0
0 1 0 0 1 0 1

4 connected 8 connected M connected

In case of M connectivity the two points are M


connected if one is the 4 neighbor of the other,
Or
one is the 4 neighbor of the other and at the same
time they don’t have any common neighbor.
Path (cont.)

8-path m-path

p p p

q q q

m-path from p to q
8-path from p to q
solves this ambiguity
results in some ambiguity
Find the shortest 4,8, and m-path between p & q
q
i)v={0,1} 3 1 2 1
ii) v={1,2} Given Image 2 2 0 2
1 2 1 1
1 0 1 1
p

i) v={0,1}
4 Path 8-Path M-Path

3 1 2 1 3 1 2 1 3 1 2 1
2 2 0 2 2 2 0 2 2 2 0 2
1 2 1 1 1 2 1 1 1 2 1 1
1 0 1 1 1 0 1 1 1 0 1 1
i) v={0,1}

4-Path 8-Path

3 1 2 1 3 1 2 1
2 2 0 2 2 2 0 2
1 2 1 1 1 2 1 1
1 0 1 1 1 0 1 1
i) v={0,1}
q
m-Path 3 1 2 1
2 2 0 2
1 2 1 1
p1 0 1 1
ii) v={1,2}

4-Path 8-Path

3 4 1
5
2
6
1 3 1 2 1
22 3
2 0 2 2 2 0 2
1 2 1 1 1 2 1 1
1
1 0 1 1 1 0 1 1
Path Length=4
Path Length=6
ii) v={1,2} 3 1 2 1
m-Path 2 2 0 2
6
3 4 1
5
2 1 1 2 1 1
22 3
2 0 2 1 0 1 1
1 2 1 1
1
1 0 1 1
Ex: Given binary image segment

Show the shortest paths using 4-path,8-path and


V={1} 0 1 1 1 1 m-path respectively.
0 0 1 0 1
0 0 1 0 1
0 1 0 0 1
1 1 1 1 1

Answer- 4-Path

0 1 1 1 1
Path Length=7
0 0 1 0 1
0 0 1 0 1
0 1 0 0 1
1 1 1 1 1
Answer- 8-Path

0 1 1 1 1
Path1: = Length=7
Path 2: = Length= 6 Redundant
0 0 1 0 1 Path
Path3: = Length=6
0 0 1 0 1
Path4: = Length=5
0 1 0 0 1

1 1 1 1 1
Shortest Path Length 4: = Length=5
Answer- m-Path

0 1 1 1 1 Path1: = Length=7

0 0 1 0 1 Path 2: = Length=6

0 0 1 0 1 Shortest Path Length=6


0 1 0 0 1

1 1 1 1 1
For V={2},determine whether S1 and S2 are
a)4-Connected b)8-Connected c) M-Connected
S1 S2

0 0 0 0 0 0 0 2
0 0 2 0 0 2 0 0
0 0 2 0 2q 2 0 0
0 2 2 2p 0 0 0 0
Answer
a) S1 and S2 are not 4-connected because q is not in the
set of N4(p)
b) S1 and S2 are 8-connected because q is in the set of
N8(p)
c) S1 and S2 are m-connected because
i)q is in the set of ND (p) and
ii) the set N4(p) ∩ N4(q) is empty
Basic operations on images
There are two different types of operations that are widely
used in image processing especially in image morphology.

1.Arithmetic Operations
2.Logical
3.Geometric
Basic operations on images detecting
decrease
to the
mask thethe
Brightening missing
anbrightness
image for
components
obtaining
of region of
the image
image
interest
Addition
Subtraction
Multiplication
Division Detect
Negative
change
To isolateof image
the in
images
interested region from
Arithmetic rest of the image
AND
OR
NOT
XOR
translation
Rotation
Logical
scaling
Geometric
Arithmetic Operations
Arithmetic operations between two pixels a and b
are denoted as follows:
i) Addition: a + b
Image addition is used in image averaging to
reduce noise. This kind of operation was
performed in image enhancement.
ii) Subtracting: a - b
Image subtraction is widely used in medical
imaging.
A very common example is the Digital Subtraction
Angiography (DSA).
Image Subtraction is basically used to get rid of
background information.
Output Image
Image1 Image 2
3 1 2 1 3 1 2 1 6 2 4 2
2 2 0 2 + 2 2 0 2 = 4 4 0 4
1 2 1 1 1 2 1 1 2 4 2 2
1 0 1 1 1 0 1 1 2 0 2 2

3 1 2 1 4 1 0 5 0 0 2 0
2 2 0 2 - 6 6 5 3 = 0 0 0 0
4 2 1 2 3 3 2 1 1 0 0 1
3 0 1 1 2 0 5 1 1 0 0 0
250 240 225 50 20 20 300 260 245 255 255 245
20 10 251 12 40 10 = 32 50 261 32 50 255
+
12 248 250 12 150 60 24 398 310 24 255 255

250 240 225 251 255 20 -1 -15 205 0 0 205


40 40 2 =
20 10 251 - -20 -30 249 0 0 249
12 248 250 12 10 40 0 238 210 0 238 210
Image Addition
Image Subtraction
Image Subtraction

a b
c d

(a) original fractal image.


(b) Result of setting the
four lower-order bit
planes to zero.
(c) Difference between (a) and
(b) .
(d) Histogram equalized
difference image.

© 2002 R. C. Gonzalez & R. E. Woods


Image Subtraction
iii) Image multiplication: a × b
iv) Image division: a/b
Both, Image Multiplication and Image Division are
used to correct grey level shading that result from
non-uniformities in illumination or in the sensor
used.

One thing that needs to be understood in arithmetic


operations is that these are carried out on an entire
image, pixel by pixel.
Arithmetic operations involve only one spatial pixel
location at a time and hence can be done in place.
Arithmetic operations are applied to multi-valued
pixels.
Image Multiplication
Image Multiplication
Image Division
Logical Operations
Logical operations commonly used are as
follows:
a) AND : a AND b
b) OR : a OR b
c) COMPLEMENT : NOT a
These operations can be combined to form
other logic operations. Logic operations actually
apply only to binary images. (Image having only
two values, 0 and 1).
The AND operator gives out 1 only when both ‘a’
and ‘b’ are equal to 1.
The OR operator gives out 1 if either ‘a’ or
‘b’ or both are equal to 1.
The COMPLEMENT (NOT) operator gives out
1 when a = 0

The COMPLEMENT (NOT) operator gives out 1 when a = 0


Logical Operations
Basic Arithmetic operations on images
Arithmetic and Logic Operations

a b

NOT(a)

a.b

a+b
Arithmetic and Logic Operations

. =

+ =
Image Subtraction

a b
c d

(a) original fractal image.


(b) Result of setting the
four lower-order bit
planes to zero.
(c) Difference between (a) and
(b) .
(d) Histogram equalized
difference image.

© 2002 R. C. Gonzalez & R. E. Woods


Cropped Image
Pixel Value
Thank
You

You might also like