SlideShare a Scribd company logo
Basic Relationships between Pixels
by
Dr. K. M. Bhurchandi
Neighbors of a Pixel
Y
Cartesian Coordinates
X
Y
Image Coordinates
X
2
Neighbors of a Pixel
f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - -
f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - -
f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - -
f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - -
I I I I I - - - - -
I I I I I - - - - -
Y
X
3
Columns
Neighbors of a Pixel
A Pixel p at coordinates (x, y) has 4 horizontal and vertical neighbors.
Their coordinates are given by:
(x+1, y) (x-1, y) (x, y+1) & (x, y-1)
f(3,2) f(1,2) f(2,3) f(2,1)
This set of pixels is called the 4-neighbors of p denoted by N4(p).
 Each pixel is unit distance from (x ,y).
f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - -
f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - -
f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - -
f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - -
I I I I I - - - - -
I I I I I - - - - -
4
Neighbors of a Pixel
A Pixel p at coordinates ( x, y) has 4 diagonal neighbors.
Their coordinates are given by:
(x+1, y+1) (x+1, y-1) (x-1, y+1) & (x-1, y-1)
f(3,3) f(3,1) f(1,3) f(1,1)
This set of pixels is called the diagonal-neighbors of p denoted by ND(p).
 diagonal neighbors + 4-neighbors = 8-neighbors of p.
They are denoted by N8(p). So, N8(p) = N4(p) + ND(p)
f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - -
f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - -
f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - -
f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - -
I I I I I - - - - -
I I I I I - - - - -
5
Adjacency, Connectivity
Adjacency: Two pixels are adjacent if they are neighbors and
their intensity level ‘V’ satisfy some specific criteria of similarity.
e.g. V = {1}
V = { 0, 2}
Binary image = { 0, 1}
Gray scale image = { 0, 1, 2, ------, 255}
In binary images, 2 pixels are adjacent if they are neighbors & have
some intensity values either 0 or 1.
In gray scale, image contains more gray level values in range 0 to
255.
6
Adjacency, Connectivity
4-adjacency:Two pixels p and q with the values from set ‘V’ are 4-
adjacent if q is in the set of N4(p).
e.g.V = { 0, 1}
1 1 0
1 1 0
1 0 1
p in Bold at center
q can be any BOLD pixel .
7
Adjacency, Connectivity
8-adjacency:Two pixels p and q with the values from set ‘V’ are 8-
adjacent if q is in the set of N8(p).
e.g.V = { 1, 2}
0 1 1
0 2 0
0 0 1
p in Bold at center
q can be any BOLD pixel .
8
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p) OR
(ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose
values are from ‘V’.
e.g.V = { 1 }
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 i
9
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g.V = { 1 }
(i) b & c
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
10
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g.V = { 1 }
(i) b & c
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
Soln: b & c are m-adjacent.
11
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g.V = { 1 }
(ii) b & e
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
12
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g.V = { 1 }
(ii) b & e
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
Soln: b & e are m-adjacent.
13
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p) OR
e.g.V = { 1 }
(iii) e & i
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 i
14
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose
values are from ‘V’.
e.g.V = { 1 }
(iii) e & i
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
15
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose
values are from ‘V’.
e.g.V = { 1 }
(iii) e & i
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
Soln: e & i are m-adjacent.
16
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p) OR
(ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose
values are from ‘V’.
e.g.V = { 1 }
(iv) e & c
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
17
Adjacency, Connectivity
m-adjacency:Two pixels p and q with the values from set ‘V’ are
m-adjacent if
(i) q is in N4(p) OR
(ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose
values are from ‘V’.
e.g.V = { 1 }
(iv) e & c
0 a 1 b 1 c
0 d 1 e 0 f
0 g 0 h 1 I
Soln: e & c are NOT m-adjacent.
18
Adjacency, Connectivity
Connectivity: 2 pixels are said to be connected if there exists a path
between them.
Let ‘S’ represent subset of pixels in an image.
Two pixels p & q are said to be connected in ‘S’ if their exists a path
between them consisting entirely of pixels in ‘S’.
For any pixel p in S, the set of pixels that are connected to it in S is called a
connected component of S.
19
Paths
Paths: A path from pixel p with coordinate (x, y) with
pixel q with coordinate (s, t) is a sequence of distinct
pixels with coordinates (x0, y0), (x1, y1), ….., (xn, yn) where
(x, y) = (x0, y0)
& (s, t) = (xn, yn)
Closed path: (x0, y0) = (xn, yn)
20
Paths
Example # 1: Consider the image segment shown in figure. Compute
length of the shortest-4, shortest-8 & shortest-m paths between pixels p
& q where,
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
21
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
22
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
23
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
24
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
25
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
26
Paths
Example # 1:
Shortest-4 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
So, Path does not exist.
27
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
28
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
29
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
30
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
31
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
32
Paths
Example # 1:
Shortest-8 path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
So, shortest-8 path = 4
33
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
34
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
35
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
36
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
37
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
38
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
39
Paths
Example # 1:
Shortest-m path:
V = {1, 2}.
4 2 3 2 q
3 3 1 3
2 3 2 2
p 2 1 2 3
So, shortest-m path = 5
40
Regions & Boundaries
Region: Let R be a subset of pixels in an image. Two regions Ri and Rj are
said to be adjacent if their union form a connected set.
Regions that are not adjacent are said to be disjoint.
We consider 4- and 8- adjacency when referring to regions.
Below regions are adjacent only if 8-adjacency is used.
1 1 1
1 0 1 Ri
0 1 0
0 0 1
1 1 1 Rj
1 1 1
41
Regions & Boundaries
Boundaries (border or contour): The boundary of a region R is
the set of points that are adjacent to points in the compliment of R.
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
BOLD 1 is NOT a member of border if 4-connectivity is used
between region and background. It is if 8-connectivity is used.
42
Distance Measures
Distance Measures: Distance between pixels p, q & z with co-
ordinates ( x, y), ( s, t) & ( v, w) resp. is given by:
a) D( p, q) ≥ 0 [ D( p, q) = 0 if p = q] …………..called reflexivity
b) D( p, q) = D( q, p) .………….called symmetry
c) D( p, z) ≤ D( p, q) + D( q, z) ..………….called transmitivity
Euclidean distance between p & q is defined as-
De( p, q) = [( x- s)2 + (y - t)2]1/2
43
Distance Measures
City Block Distance: The D4 distance between p & q is defined as
D4( p, q) = |x - s| + |y - t|
In this case, pixels having D4 distance from ( x, y) less than or equal
to some value r form a diamond centered at ( x, y).
2
2 1 2
2 1 0 1 2
2 1 2
2
Pixels with D4 distance ≤ 2 forms the following contour of constant
distance.
44
Distance Measures
Chess-Board Distance: The D8 distance between p & q is
defined as
D8( p, q) = max( |x - s| , |y - t| )
In this case, pixels having D8 distance from ( x, y) less than or equal
to some value r form a square centered at ( x, y).
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 distance ≤ 2 forms the following contour of constant
distance. 45

More Related Content

What's hot

digital image processing
digital image processingdigital image processing
digital image processing
Abinaya B
 
Image Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersImage Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain Filters
Karthika Ramachandran
 
5. gray level transformation
5. gray level transformation5. gray level transformation
5. gray level transformation
MdFazleRabbi18
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
Poonam Seth
 
Image segmentation
Image segmentation Image segmentation
Thresholding.ppt
Thresholding.pptThresholding.ppt
Thresholding.ppt
shankar64
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
DEEPASHRI HK
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
asodariyabhavesh
 
Lecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image ProcessingLecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image Processing
VARUN KUMAR
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
Noise Models
Noise ModelsNoise Models
Noise Models
Sardar Alam
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
Shivangi Saxena
 
Bit plane coding
Bit plane codingBit plane coding
Bit plane coding
priyadharshini murugan
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
PundrikPatel
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
Naveen Kumar
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processing
PremaPRC211300301103
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
Mostafa G. M. Mostafa
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
Gichelle Amon
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
Wiener Filter
Wiener FilterWiener Filter
Wiener Filter
Akshat Ratanpal
 

What's hot (20)

digital image processing
digital image processingdigital image processing
digital image processing
 
Image Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersImage Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain Filters
 
5. gray level transformation
5. gray level transformation5. gray level transformation
5. gray level transformation
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Thresholding.ppt
Thresholding.pptThresholding.ppt
Thresholding.ppt
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Lecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image ProcessingLecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image Processing
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)
 
Noise Models
Noise ModelsNoise Models
Noise Models
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
Bit plane coding
Bit plane codingBit plane coding
Bit plane coding
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processing
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
Mathematical tools in dip
 
Wiener Filter
Wiener FilterWiener Filter
Wiener Filter
 

Similar to Pixel relationships

Pixelrelationships
PixelrelationshipsPixelrelationships
Pixelrelationships
Harshavardhan Reddy
 
pixelrelationships-m-1.pptx.ppt
pixelrelationships-m-1.pptx.pptpixelrelationships-m-1.pptx.ppt
pixelrelationships-m-1.pptx.ppt
JayanthHN1
 
DIP7_Relationships_between_pixels.ppt
DIP7_Relationships_between_pixels.pptDIP7_Relationships_between_pixels.ppt
DIP7_Relationships_between_pixels.ppt
akshaya870130
 
Image_Processing-ch2surface r_part_2.ppt
Image_Processing-ch2surface r_part_2.pptImage_Processing-ch2surface r_part_2.ppt
Image_Processing-ch2surface r_part_2.ppt
Praveen Kumar
 
3.ppt
3.ppt3.ppt
3.ppt
anshharjai
 
The Digital Image Processing Q@A
The Digital Image Processing Q@AThe Digital Image Processing Q@A
The Digital Image Processing Q@A
Chung Hua Universit
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
Amnaakhaan
 
Ip unit 1
Ip unit 1Ip unit 1
Ip unit 1
Dr. Radhey Shyam
 
Lecture4.ppt
Lecture4.pptLecture4.ppt
Lecture4.ppt
SivaSankar306103
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
PreethiPreethi28
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel Relation
Varun Ojha
 
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdfchapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
Someone413715
 
E field dipole
E field dipoleE field dipole
E field dipole
FFMdeMul
 
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant EdgesOn the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
GiselleginaGloria
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIP
babak danyal
 
Graph
GraphGraph
Digital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.pptDigital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.ppt
MrsSDivyaBME
 
Vector space
Vector spaceVector space
Vector space
Jaimin Patel
 
chap2.ppt
chap2.pptchap2.ppt
chap2.ppt
akshaya870130
 
Geometry (Grid & section formula)
Geometry (Grid & section formula)Geometry (Grid & section formula)
Geometry (Grid & section formula)
itutor
 

Similar to Pixel relationships (20)

Pixelrelationships
PixelrelationshipsPixelrelationships
Pixelrelationships
 
pixelrelationships-m-1.pptx.ppt
pixelrelationships-m-1.pptx.pptpixelrelationships-m-1.pptx.ppt
pixelrelationships-m-1.pptx.ppt
 
DIP7_Relationships_between_pixels.ppt
DIP7_Relationships_between_pixels.pptDIP7_Relationships_between_pixels.ppt
DIP7_Relationships_between_pixels.ppt
 
Image_Processing-ch2surface r_part_2.ppt
Image_Processing-ch2surface r_part_2.pptImage_Processing-ch2surface r_part_2.ppt
Image_Processing-ch2surface r_part_2.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
The Digital Image Processing Q@A
The Digital Image Processing Q@AThe Digital Image Processing Q@A
The Digital Image Processing Q@A
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
 
Ip unit 1
Ip unit 1Ip unit 1
Ip unit 1
 
Lecture4.ppt
Lecture4.pptLecture4.ppt
Lecture4.ppt
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel Relation
 
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdfchapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
chapter_4_1ST_PART_BASIC_RELATION_OF_PIXELSchapter_2_dip_5th_sem.pdf
 
E field dipole
E field dipoleE field dipole
E field dipole
 
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant EdgesOn the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIP
 
Graph
GraphGraph
Graph
 
Digital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.pptDigital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.ppt
 
Vector space
Vector spaceVector space
Vector space
 
chap2.ppt
chap2.pptchap2.ppt
chap2.ppt
 
Geometry (Grid & section formula)
Geometry (Grid & section formula)Geometry (Grid & section formula)
Geometry (Grid & section formula)
 

More from Visvesvaraya National Institute of Technology, Nagpur, Maharashtra, India

Wavelet transform
Wavelet transformWavelet transform
Spatial filtering
Spatial filteringSpatial filtering
Radon transform numerical & Fourier slice theorem
Radon transform numerical & Fourier slice theoremRadon transform numerical & Fourier slice theorem
Radon transform numerical & Fourier slice theorem
Visvesvaraya National Institute of Technology, Nagpur, Maharashtra, India
 
Morphological image processing
Morphological image processingMorphological image processing
Image transforms
Image transformsImage transforms
Image segmentation
Image segmentationImage segmentation
Image restoration and reconstruction
Image restoration and reconstructionImage restoration and reconstruction
Histogram processing
Histogram processingHistogram processing
Image enhancement
Image enhancementImage enhancement

More from Visvesvaraya National Institute of Technology, Nagpur, Maharashtra, India (9)

Wavelet transform
Wavelet transformWavelet transform
Wavelet transform
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
Radon transform numerical & Fourier slice theorem
Radon transform numerical & Fourier slice theoremRadon transform numerical & Fourier slice theorem
Radon transform numerical & Fourier slice theorem
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
Image transforms
Image transformsImage transforms
Image transforms
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Image restoration and reconstruction
Image restoration and reconstructionImage restoration and reconstruction
Image restoration and reconstruction
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 

Recently uploaded

Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 

Recently uploaded (20)

Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 

Pixel relationships

  • 1. Basic Relationships between Pixels by Dr. K. M. Bhurchandi
  • 2. Neighbors of a Pixel Y Cartesian Coordinates X Y Image Coordinates X 2
  • 3. Neighbors of a Pixel f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - - f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - - f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - - f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - - I I I I I - - - - - I I I I I - - - - - Y X 3 Columns
  • 4. Neighbors of a Pixel A Pixel p at coordinates (x, y) has 4 horizontal and vertical neighbors. Their coordinates are given by: (x+1, y) (x-1, y) (x, y+1) & (x, y-1) f(3,2) f(1,2) f(2,3) f(2,1) This set of pixels is called the 4-neighbors of p denoted by N4(p).  Each pixel is unit distance from (x ,y). f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - - f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - - f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - - f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - - I I I I I - - - - - I I I I I - - - - - 4
  • 5. Neighbors of a Pixel A Pixel p at coordinates ( x, y) has 4 diagonal neighbors. Their coordinates are given by: (x+1, y+1) (x+1, y-1) (x-1, y+1) & (x-1, y-1) f(3,3) f(3,1) f(1,3) f(1,1) This set of pixels is called the diagonal-neighbors of p denoted by ND(p).  diagonal neighbors + 4-neighbors = 8-neighbors of p. They are denoted by N8(p). So, N8(p) = N4(p) + ND(p) f(1,1) f(1,2) f(1,3) f(1,4) f(1,5) - - - - - f(2,1) f(2,2) f(2,3) f(2,4) f(2,5) - - - - - f(x,y) = f(3,1) f(3,2) f(3,3) f(3,4) f(3,5) - - - - - f(4,1) f(4,2) f(4,3) f(4,4) f(4,5) - - - - - I I I I I - - - - - I I I I I - - - - - 5
  • 6. Adjacency, Connectivity Adjacency: Two pixels are adjacent if they are neighbors and their intensity level ‘V’ satisfy some specific criteria of similarity. e.g. V = {1} V = { 0, 2} Binary image = { 0, 1} Gray scale image = { 0, 1, 2, ------, 255} In binary images, 2 pixels are adjacent if they are neighbors & have some intensity values either 0 or 1. In gray scale, image contains more gray level values in range 0 to 255. 6
  • 7. Adjacency, Connectivity 4-adjacency:Two pixels p and q with the values from set ‘V’ are 4- adjacent if q is in the set of N4(p). e.g.V = { 0, 1} 1 1 0 1 1 0 1 0 1 p in Bold at center q can be any BOLD pixel . 7
  • 8. Adjacency, Connectivity 8-adjacency:Two pixels p and q with the values from set ‘V’ are 8- adjacent if q is in the set of N8(p). e.g.V = { 1, 2} 0 1 1 0 2 0 0 0 1 p in Bold at center q can be any BOLD pixel . 8
  • 9. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) OR (ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose values are from ‘V’. e.g.V = { 1 } 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 i 9
  • 10. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) e.g.V = { 1 } (i) b & c 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I 10
  • 11. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) e.g.V = { 1 } (i) b & c 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I Soln: b & c are m-adjacent. 11
  • 12. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) e.g.V = { 1 } (ii) b & e 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I 12
  • 13. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) e.g.V = { 1 } (ii) b & e 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I Soln: b & e are m-adjacent. 13
  • 14. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) OR e.g.V = { 1 } (iii) e & i 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 i 14
  • 15. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose values are from ‘V’. e.g.V = { 1 } (iii) e & i 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I 15
  • 16. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose values are from ‘V’. e.g.V = { 1 } (iii) e & i 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I Soln: e & i are m-adjacent. 16
  • 17. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) OR (ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose values are from ‘V’. e.g.V = { 1 } (iv) e & c 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I 17
  • 18. Adjacency, Connectivity m-adjacency:Two pixels p and q with the values from set ‘V’ are m-adjacent if (i) q is in N4(p) OR (ii) q is in ND(p) & the set N4(p) n N4(q) have no pixels whose values are from ‘V’. e.g.V = { 1 } (iv) e & c 0 a 1 b 1 c 0 d 1 e 0 f 0 g 0 h 1 I Soln: e & c are NOT m-adjacent. 18
  • 19. Adjacency, Connectivity Connectivity: 2 pixels are said to be connected if there exists a path between them. Let ‘S’ represent subset of pixels in an image. Two pixels p & q are said to be connected in ‘S’ if their exists a path between them consisting entirely of pixels in ‘S’. For any pixel p in S, the set of pixels that are connected to it in S is called a connected component of S. 19
  • 20. Paths Paths: A path from pixel p with coordinate (x, y) with pixel q with coordinate (s, t) is a sequence of distinct pixels with coordinates (x0, y0), (x1, y1), ….., (xn, yn) where (x, y) = (x0, y0) & (s, t) = (xn, yn) Closed path: (x0, y0) = (xn, yn) 20
  • 21. Paths Example # 1: Consider the image segment shown in figure. Compute length of the shortest-4, shortest-8 & shortest-m paths between pixels p & q where, V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 21
  • 22. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 22
  • 23. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 23
  • 24. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 24
  • 25. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 25
  • 26. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 26
  • 27. Paths Example # 1: Shortest-4 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 So, Path does not exist. 27
  • 28. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 28
  • 29. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 29
  • 30. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 30
  • 31. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 31
  • 32. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 32
  • 33. Paths Example # 1: Shortest-8 path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 So, shortest-8 path = 4 33
  • 34. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 34
  • 35. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 35
  • 36. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 36
  • 37. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 37
  • 38. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 38
  • 39. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 39
  • 40. Paths Example # 1: Shortest-m path: V = {1, 2}. 4 2 3 2 q 3 3 1 3 2 3 2 2 p 2 1 2 3 So, shortest-m path = 5 40
  • 41. Regions & Boundaries Region: Let R be a subset of pixels in an image. Two regions Ri and Rj are said to be adjacent if their union form a connected set. Regions that are not adjacent are said to be disjoint. We consider 4- and 8- adjacency when referring to regions. Below regions are adjacent only if 8-adjacency is used. 1 1 1 1 0 1 Ri 0 1 0 0 0 1 1 1 1 Rj 1 1 1 41
  • 42. Regions & Boundaries Boundaries (border or contour): The boundary of a region R is the set of points that are adjacent to points in the compliment of R. 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 BOLD 1 is NOT a member of border if 4-connectivity is used between region and background. It is if 8-connectivity is used. 42
  • 43. Distance Measures Distance Measures: Distance between pixels p, q & z with co- ordinates ( x, y), ( s, t) & ( v, w) resp. is given by: a) D( p, q) ≥ 0 [ D( p, q) = 0 if p = q] …………..called reflexivity b) D( p, q) = D( q, p) .………….called symmetry c) D( p, z) ≤ D( p, q) + D( q, z) ..………….called transmitivity Euclidean distance between p & q is defined as- De( p, q) = [( x- s)2 + (y - t)2]1/2 43
  • 44. Distance Measures City Block Distance: The D4 distance between p & q is defined as D4( p, q) = |x - s| + |y - t| In this case, pixels having D4 distance from ( x, y) less than or equal to some value r form a diamond centered at ( x, y). 2 2 1 2 2 1 0 1 2 2 1 2 2 Pixels with D4 distance ≤ 2 forms the following contour of constant distance. 44
  • 45. Distance Measures Chess-Board Distance: The D8 distance between p & q is defined as D8( p, q) = max( |x - s| , |y - t| ) In this case, pixels having D8 distance from ( x, y) less than or equal to some value r form a square centered at ( x, y). 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 distance ≤ 2 forms the following contour of constant distance. 45