Professional Documents
Culture Documents
0 0 1 2 3 4 5 6 7 8 9 0 1 1 1 2 4 1 1 2 3 3 1 1 2 4 2 1 1 3 5 2 1 1 4 6 1 1 4 7 Rows Are Numbered 0 - 7 and Columns 0 - 9
0 0 1 2 3 4 5 6 7 8 9 0 1 1 1 2 4 1 1 2 3 3 1 1 2 4 2 1 1 3 5 2 1 1 4 6 1 1 4 7 Rows Are Numbered 0 - 7 and Columns 0 - 9
0 0 1 2 3 4 5 6 7 8 9 0 1 1 1 2 4 1 1 2 3 3 1 1 2 4 2 1 1 3 5 2 1 1 4 6 1 1 4 7 Rows Are Numbered 0 - 7 and Columns 0 - 9
0 0 1 2 3 4 5 6 7 8 9
The pixels highlighted in yellow
0 0 0 0 0 0 0 0 0 0 0
are the boundary pixels. The
1 0 0 0 0 4 1 1 0 0 0 pixels highlighted in green are
the neighbors surrounding the
2 0 0 0 4 1 0 1 2 0 0
highlighted border pixel. For
3 0 0 3 1 0 0 0 1 2 0 tracing the outer boundary, you
4 0 0 2 1 0 0 0 1 3 0 travel the neighbors in a
clockwise direction until you
5 0 0 0 2 1 0 1 4 0 0
find a ‘1’ in the path. That ‘1’
6 0 0 0 0 1 1 4 0 0 0 will be the new boundary pixel.
7 0 0 0 0 0 0 0 0 0 0 You repeat the process until you
come to the starting 01
Rows are numbered 0 - 7 and columns 0 - 9
transition. The starting 0 -1
1) Scan the image left to right starting at (0, 0) pixels have light blue highlights.
2) If no 0 1 transition, move to next row Border pixels are then labelled 1
3) Continue this scanning until you get a 0 1 (Row 1, Col
through 4. 3->4)
Let (id, jd) be the location of ‘0’ and (ic, jc) the location of ‘1’. (id, jd) = (1, 3) and
(ic, jc) = (1, 4) are the row and column numbers of ‘0’ and ‘1’.
Let k1 = ic-id and k2 = jc-jd. Then starting at (id, jd) we derive the
coordinates of the eight neighbors in a clockwise direction. In this specific
case, k1 = 0 and k2 = 1. If k2 = 1, then we go up and move in a clockwise
direction. Then the eight neighbors are
(1, 3), (0, 3), (0, 4), (0, 5), (1, 5), (2, 5), (2, 4), (2, 3)
If k2 = -1 then you go down. Also only k1 or k2 can be 1 or -1.
4) Find the coordinates of the eight neighbors surrounding the ‘1’
5) Starting at the ‘0’, go around the neighbors in a clockwise direction until you
get another 0 1 transition.
Repeat 4) and 5) until you come to the starting point.
Note: If ‘0’ is on the left same row go up. If ‘0’ is on the right in the same row go
down. If ‘0’ is above ‘1’ on the same column, go right. If ‘0’ is below ‘1’ on the
same column, go left. It is that simple.
If the new border pixel is to the E of the previous one, label it as ‘1’. If it is SE or
NW, label it as ‘2’. If it is S or N, label it as ‘2’. If is SW or NE, label it as’4’.
E – East, S = South, N – North, SE – Southeast, SW – Southwest, NE –
Northeast, NW – Northwest.
1-E
4-SW 3-S 2-SE
k1= ic-id, k2 = jc-jd (Four Possibilities)
x1 x2 x3 x5 x6 x7 x7 0 x1 x3 x4 x5
0 1 x4 x4 1 0 x6 1 x2 x2 1 x6
x7 x6 x5 x3 x2 x1 x5 x4 x3 x1 0 x7
0 on the left 0 on the right 0 above 0 below
k1 = 0, k2 = 1 k1 = 0, k2 = -1 k1 = 1, k2 = 0 k1 = -1, k2 = 0
------------------------------------------------------------------------------------------------------------
Calculation of neighbor coordinates