SlideShare a Scribd company logo
Some Basic Relationships
Between Pixels
• Definitions:
– f(x,y): digital image
– Pixels: q, p
– Subset of pixels of f(x,y): S
Neighbors of a Pixel
• A pixel p at (x,y) has 2 horizontal and 2
vertical neighbors:
– (x+1,y), (x-1,y), (x,y+1), (x,y-1)
– This set of pixels is called the 4-neighbors
of p: N4(p)
Neighbors of a Pixel
• The 4 diagonal neighbors of p are: (ND(p))
– (x+1,y+1), (x+1,y-1), (x-1,y+1), (x-1,y-1)
• N4(p) + ND(p)  N8(p): the 8-neighbors of p
Connectivity
• Connectivity between pixels is important:
– Because it is used in establishing boundaries of
objects and components of regions in an image
Connectivity
• Two pixels are connected if:
– They are neighbors (i.e. adjacent in some sense -
- e.g. N4(p), N8(p), …)
– Their gray levels satisfy a specified criterion of
similarity (e.g. equality, …)
• V is the set of gray-level values used to
define adjacency (e.g. V={1} for adjacency
of pixels of value 1)
Adjacency
• We consider three types of adjacency:
– 4-adjacency: two pixels p and q with values from
V are 4-adjacent if q is in the set N4(p)
– 8-adjacency : p & q are 8- adjacent if q is in the
set N8(p)
Adjacency
• The third type of adjacency:
– m-adjacency: p & q with values from V are m-
adjacent if
• q is in N4(p) or
• q is in ND(p) and the set N4(p)N4(q) has no pixels with
values from V
Adjacency
• Mixed adjacency is a modification of 8-
adjacency and is used to eliminate the
multiple path connections that often arise
when 8-adjacency is used.
1
0
0
0
1
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
1
0
1
1
0
Adjacency
• Two image subsets S1 and S2 are adjacent if some
pixel in S1 is adjacent to some pixel in S2.
Path
• A path (curve) from pixel p with coordinates
(x,y) to pixel q with coordinates (s,t) is a
sequence of distinct pixels:
– (x0,y0), (x1,y1), …, (xn,yn)
– where (x0,y0)=(x,y), (xn,yn)=(s,t), and
(xi,yi) is adjacent to (xi-1,yi-1), for
1≤i ≤n ; n is the length of the path.
• If (xo, yo) = (xn, yn): a closed path
Paths
• 4-, 8-, m-paths can be defined depending on
the type of adjacency specified.
• If p,q  S, then q is connected to p in S if
there is a path from p to q consisting
entirely of pixels in S.
Connectivity
• For any pixel p in S, the set of pixels in S
that are connected to p is a connected
component of S.
• If S has only one connected component then
S is called a connected set.
Boundary
• R a subset of pixels: R is a region if R is a
connected set.
• Its boundary (border, contour) is the set of
pixels in R that have at least one neighbor
not in R
• Edge can be the region boundary (in binary
images)
Distance Measures
• For pixels p,q,z with coordinates (x,y), (s,t),
(u,v), D is a distance function or metric if:
– D(p,q) ≥ 0 (D(p,q)=0 iff p=q)
– D(p,q) = D(q,p) and
– D(p,z) ≤ D(p,q) + D(q,z)
Distance Measures
• Euclidean distance:
– De(p,q) = [(x-s)2 + (y-t)2]1/2
– Points (pixels) having a distance less than or
equal to r from (x,y) are contained in a disk of
radius r centered at (x,y).
Distance Measures
• D4 distance (city-block distance):
– D4(p,q) = |x-s| + |y-t|
– forms a diamond centered at (x,y)
– e.g. pixels with D4≤2 from p
2
2
1
2
2
1
0
1
2
2
1
2
2
D4 = 1 are the 4-neighbors of p
Distance Measures
• D8 distance (chessboard distance):
– D8(p,q) = max(|x-s|,|y-t|)
– Forms a square centered at p
– e.g. pixels with D8≤2 from p
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
D8 = 1 are the 8-neighbors of p
Distance Measures
• D4 and D8 distances between p and q are
independent of any paths that exist between
the points because these distances involve
only the coordinates of the points
(regardless of whether a connected path
exists between them).
Distance Measures
• However, for m-connectivity the value of the
distance (length of path) between two pixels
depends on the values of the pixels along the
path and those of their neighbors.
Distance Measures
• e.g. assume p, p2, p4 = 1
p1, p3 = can have either 0 or 1
p
p
p
p
p
2
1
4
3
If only connectivity of pixels valued 1 is
allowed, and p1 and p3 are 0, the m-
distance between p and p4 is 2.
If either p1 or p3 is 1, the distance is 3.
If both p1 and p3 are 1, the distance is 4
(pp1p2p3p4)

More Related Content

Similar to Lecture4.ppt

Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
Amnaakhaan
 
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
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIP
babak danyal
 
Digital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.pptDigital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.ppt
MrsSDivyaBME
 
chap2.ppt
chap2.pptchap2.ppt
chap2.ppt
akshaya870130
 
digital image processing chapter two, fundamentals
digital image processing chapter two, fundamentalsdigital image processing chapter two, fundamentals
digital image processing chapter two, fundamentals
KNaveenKumarECE
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Saikrishna Tanguturu
 
chap2.ppt is the presentation of image of eye.
chap2.ppt is the presentation of image of eye.chap2.ppt is the presentation of image of eye.
chap2.ppt is the presentation of image of eye.
YogeshRotela
 
2 digital image fundamentals
2 digital image fundamentals2 digital image fundamentals
2 digital image fundamentals
BHAGYAPRASADBUGGE
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
Roziq Bahtiar
 
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
 
Ip unit 1
Ip unit 1Ip unit 1
Ip unit 1
Dr. Radhey Shyam
 
Image processing 1-lectures
Image processing  1-lecturesImage processing  1-lectures
Image processing 1-lectures
Taymoor Nazmy
 
Digital Distance Geometry
Digital Distance GeometryDigital Distance Geometry
Digital Distance Geometry
ppd1961
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
Mohd Arif
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.
Mohd Arif
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
ALIZAIB KHAN
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
AliZaib71
 
2. IP Fundamentals.pdf
2. IP Fundamentals.pdf2. IP Fundamentals.pdf
2. IP Fundamentals.pdf
DrNVaijayanthiDeanRD
 

Similar to Lecture4.ppt (20)

Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
 
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
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIP
 
Digital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.pptDigital Image Fundamentals 1.ppt
Digital Image Fundamentals 1.ppt
 
chap2.ppt
chap2.pptchap2.ppt
chap2.ppt
 
digital image processing chapter two, fundamentals
digital image processing chapter two, fundamentalsdigital image processing chapter two, fundamentals
digital image processing chapter two, fundamentals
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
chap2.ppt is the presentation of image of eye.
chap2.ppt is the presentation of image of eye.chap2.ppt is the presentation of image of eye.
chap2.ppt is the presentation of image of eye.
 
2 digital image fundamentals
2 digital image fundamentals2 digital image fundamentals
2 digital image fundamentals
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
The Digital Image Processing Q@A
The Digital Image Processing Q@AThe Digital Image Processing Q@A
The Digital Image Processing Q@A
 
Ip unit 1
Ip unit 1Ip unit 1
Ip unit 1
 
Image processing 1-lectures
Image processing  1-lecturesImage processing  1-lectures
Image processing 1-lectures
 
Digital Distance Geometry
Digital Distance GeometryDigital Distance Geometry
Digital Distance Geometry
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
Mathematical tools in dip
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
2. IP Fundamentals.pdf
2. IP Fundamentals.pdf2. IP Fundamentals.pdf
2. IP Fundamentals.pdf
 

Recently uploaded

Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
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
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
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
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
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
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 

Recently uploaded (20)

Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
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
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
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
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
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
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 

Lecture4.ppt

  • 1. Some Basic Relationships Between Pixels • Definitions: – f(x,y): digital image – Pixels: q, p – Subset of pixels of f(x,y): S
  • 2. Neighbors of a Pixel • A pixel p at (x,y) has 2 horizontal and 2 vertical neighbors: – (x+1,y), (x-1,y), (x,y+1), (x,y-1) – This set of pixels is called the 4-neighbors of p: N4(p)
  • 3. Neighbors of a Pixel • The 4 diagonal neighbors of p are: (ND(p)) – (x+1,y+1), (x+1,y-1), (x-1,y+1), (x-1,y-1) • N4(p) + ND(p)  N8(p): the 8-neighbors of p
  • 4. Connectivity • Connectivity between pixels is important: – Because it is used in establishing boundaries of objects and components of regions in an image
  • 5. Connectivity • Two pixels are connected if: – They are neighbors (i.e. adjacent in some sense - - e.g. N4(p), N8(p), …) – Their gray levels satisfy a specified criterion of similarity (e.g. equality, …) • V is the set of gray-level values used to define adjacency (e.g. V={1} for adjacency of pixels of value 1)
  • 6. Adjacency • We consider three types of adjacency: – 4-adjacency: two pixels p and q with values from V are 4-adjacent if q is in the set N4(p) – 8-adjacency : p & q are 8- adjacent if q is in the set N8(p)
  • 7. Adjacency • The third type of adjacency: – m-adjacency: p & q with values from V are m- adjacent if • q is in N4(p) or • q is in ND(p) and the set N4(p)N4(q) has no pixels with values from V
  • 8. Adjacency • Mixed adjacency is a modification of 8- adjacency and is used to eliminate the multiple path connections that often arise when 8-adjacency is used. 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0
  • 9. Adjacency • Two image subsets S1 and S2 are adjacent if some pixel in S1 is adjacent to some pixel in S2.
  • 10. Path • A path (curve) from pixel p with coordinates (x,y) to pixel q with coordinates (s,t) is a sequence of distinct pixels: – (x0,y0), (x1,y1), …, (xn,yn) – where (x0,y0)=(x,y), (xn,yn)=(s,t), and (xi,yi) is adjacent to (xi-1,yi-1), for 1≤i ≤n ; n is the length of the path. • If (xo, yo) = (xn, yn): a closed path
  • 11. Paths • 4-, 8-, m-paths can be defined depending on the type of adjacency specified. • If p,q  S, then q is connected to p in S if there is a path from p to q consisting entirely of pixels in S.
  • 12. Connectivity • For any pixel p in S, the set of pixels in S that are connected to p is a connected component of S. • If S has only one connected component then S is called a connected set.
  • 13. Boundary • R a subset of pixels: R is a region if R is a connected set. • Its boundary (border, contour) is the set of pixels in R that have at least one neighbor not in R • Edge can be the region boundary (in binary images)
  • 14. Distance Measures • For pixels p,q,z with coordinates (x,y), (s,t), (u,v), D is a distance function or metric if: – D(p,q) ≥ 0 (D(p,q)=0 iff p=q) – D(p,q) = D(q,p) and – D(p,z) ≤ D(p,q) + D(q,z)
  • 15. Distance Measures • Euclidean distance: – De(p,q) = [(x-s)2 + (y-t)2]1/2 – Points (pixels) having a distance less than or equal to r from (x,y) are contained in a disk of radius r centered at (x,y).
  • 16. Distance Measures • D4 distance (city-block distance): – D4(p,q) = |x-s| + |y-t| – forms a diamond centered at (x,y) – e.g. pixels with D4≤2 from p 2 2 1 2 2 1 0 1 2 2 1 2 2 D4 = 1 are the 4-neighbors of p
  • 17. Distance Measures • D8 distance (chessboard distance): – D8(p,q) = max(|x-s|,|y-t|) – Forms a square centered at p – e.g. pixels with D8≤2 from p 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 D8 = 1 are the 8-neighbors of p
  • 18. Distance Measures • D4 and D8 distances between p and q are independent of any paths that exist between the points because these distances involve only the coordinates of the points (regardless of whether a connected path exists between them).
  • 19. Distance Measures • However, for m-connectivity the value of the distance (length of path) between two pixels depends on the values of the pixels along the path and those of their neighbors.
  • 20. Distance Measures • e.g. assume p, p2, p4 = 1 p1, p3 = can have either 0 or 1 p p p p p 2 1 4 3 If only connectivity of pixels valued 1 is allowed, and p1 and p3 are 0, the m- distance between p and p4 is 2. If either p1 or p3 is 1, the distance is 3. If both p1 and p3 are 1, the distance is 4 (pp1p2p3p4)