Some Basic Relationships Between Pixels
Some Basic Relationships Between Pixels
I)Neighbors of a Pixel
1. A pixel p at coordinates (x, y) has four horizontal and vertical neighbors whose
coordinates are given by
2. This set of pixels, called the 4-neighbors of p, is denoted by N4(p). Each pixel is a
unit distance from (x, y), and some of the neighbor locations of p lie outside the
digital image if (x, y) is on the border of the image.
and are denoted by ND(p). These points, together with the 4-neighbors, are called
the 8-neighbors of p, denoted by N8(p). As before, some of the neighbor locations
in ND(p) and N8(p) fail outside the image if (x, y) is on the border of the image.
1. Let V be the set of intensity values used to define adjacency. In a binary image, V
= {1} if we are referring to adjacency of pixels with value 1. In a gray-scale
image, the idea is the same, but set V typically contains more elements. We
consider three types of adjacency:
2. Mixed adjacency is introduced to eliminate the ambiguities that often arise when
8-adjacency is used. For example, consider the pixel arrangement shown in Fig.
2.25(a) for V = {1}. The three pixels at the top of Fig. 2.25(b) show multiple
(ambiguous) 8-adjacency, as indicated by the dashed lines. This ambiguity is
removed by using m-adjacency, as shown in Fig. 2.25(c).
3. Let S represent a subset of pixels in an image. For any pixel p in S, the set of
pixels that are connected to it in S is called a connected component of S. If it only
has one connected component, then set S is called a connected set.
(d)
(d) Two regions (of 1s) that are adjacent if 8-adjecency is used.
5. The boundary of a region R is the set of points that are adjacent to points in the
complement of R. Here again, we must specify the connectivity being used to
define adjacency. For example, the point circled in Fig. 2.25(e) is not a member of
the border of the 1-valued region if 4-connectivity is used between the region and
its background.
(e)
(e) The circled point is part of the boundary of the 1-valued pixels only if 8-
adjacency between the region and background is used.
(f)
(f) The inner boundary of the 1-valued region does not form a closed path, but its outer
boundary does.
1. For pixels p, q, and z, with coordinates (x, y), (s, t), and (v, w), respectively, D is a
distance function or metric if
4. In this case, the pixels having a D4 distance from (x, y) less than or equal to some
value r form a diamond centered at (x, y). For example, the pixels with
D4 distance ≤ 2 from (x, y) (the center point) form the following contours of
constant distance:
6. In this case, the pixels with D8 distance from (x, y) less than or equal to some
value r form a square centered at (x,y). For example, the pixels with D8 distance ≤
2 from (x, y) (the center point) form the following contours of constant distance:
7. The pixels with D8 = 1 are the 8-neighbors of (x, y). Note that the D4 and D8
distances between p and q are independent of any paths that might exist between
the points because these distances involve only the coordinates of the points.