Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing Lecture 13: Image Topology - Skeletonization Prof. Charlene Tsai.

Similar presentations


Presentation on theme: "Digital Image Processing Lecture 13: Image Topology - Skeletonization Prof. Charlene Tsai."— Presentation transcript:

1 Digital Image Processing Lecture 13: Image Topology - Skeletonization Prof. Charlene Tsai

2 2 Introduction Skeleton of a binary object: a collection of lines and curves which encapsulate the size/shape of the object. Application example: hand gesture recognition

3 3 Application Example Application example: handwriting digits recognition

4 4 Application Example Application example: human body analysis video imagemotion detectionskeleton

5 5 What is a skeleton? A skeleton can be defined by medial axis of an object: a pixel is on the medial axis if is equidistant from at least two pixels on the boundary of the object. Methods of approaching the medial axis:  Imagine the object to be burning up by a fire which advances at a constant rate from the boundary. The places where two lines of fire meet form the medial axis.  Consider the set of all circles lying within the object which touch at least two points on the boundary. The centres of all such circles form the medial axis.

6 6 Topological Methods We can directly define those pixels which are to be deleted to obtain the final skeleton. In general, we want to delete pixels which can be deleted without changing the topology of an object:  i.e., the number of components, the number of holes, or the relationship of objects and holes unchanged Example 1 A non-deletable pixel: creates a hole

7 7 More Examples Example 2 A non-deletable pixel: removes a hole Example 3 A non-deletable pixel: disconnects an object

8 8 4-simple: A pixel which can be deleted without changing the 4-connectivity of the object; 8-simple: A pixel which can be deleted without changing the 8-connectivity of the object. Example 4 A non-deletable pixel: 4-connectivity 8-connectivity 4-connectivity Neither 4-simple Nor 8-simple 8-simple Not 4-simple More Examples

9 9 Check for Deletability of a Pixel A pixel’s deletability can be tested by checking its 3x3 neighbourhood. For this example, checking the deletability of the central pixel:  The top two pixels and the bottom two pixels become separated, thus breaking up the object.  The top two pixels and the bottom two pixels are joined by a chain of pixels outside the neighbourhood, i.e, all pixels will encircle a hole, and removing the central pixel will remove the hole

10 10 (con ’ d) To check whether a pixel is 4-simple or 8-simple, introduce some numbers associated with the neighbourhood of a foreground pixel Define Np : the 3x3 neighbourhood of p, Np* : the 3x3 neighbourhood excluding p Then,  A(p): the number of 4-components in Np*  C(p): the number of 8-components in Np*  B(p): the number of foreground pixels in Np* A(p) = 2 C(p) = 2 B(p) = 4 A(p) = 2 C(p) = 1 B(p) = 5

11 11 (con ’ d) The importance of simple points for deletion: A foreground pixel p is 4-simple iff A(p)=1, and is 8-simple iff C(p)=1  Since C(p)=1 the central pixel is 8-simple and so can be deleted without affecting the 8-connectivity of the object.  But since A(p)~=1, the central pixel is not 4-simple and so cannot be deleted without affecting the 4-connectivity of the object. o o o A(p)=2 C(p)=1 o o o o o o

12 12 Calculating A(p) and C(p) For A(p) we are only interested in the case where A(p)=1 and this can be determined by calculating the crossing number X(p) of a foreground pixel The crossing number X(p) of a foreground pixel p is defined to be the number of times a 0 is followed by a 1 as we traverse the 8-neighbours of p in a clockwise direction If X(p) =1, then A(p)=1 and so p is 4-simple p 1 p 2 p 3 p 8 p p 4 p 7 p 6 p 5 p 1, p 2, p 3, p 4, p 5, p 6, p 7, p 8, p 1 11 0 0 p 0 0 1 1 1, 1, 0, 0, 1, 1, 0, 0, 1 X(p)=2

13 13 More Practice on Calculating A(p) 11 0 1 P 1 0 0 1 1, 1, 0, 1, 1, 0, 0, 1, 1 X(p)=2 11 1 1 P 1 1 0 0 1, 1, 1, 1, 0, 0, 1, 1, 1 X(p)=1 11 1 0 P 0 1 0 1 1, 1, 0, 0, 1, 0, 1, 0, 1 X(p)=3

14 14 o Calculating C(p) p 1 p 2 p 3 p 8 p p 4 p 7 p 6 p 5 o o o

15 15 How not to do skeletonization In general, a skeletonization algorithm works by an iteration process: at each step identifying deletable pixels, and deleting them. The algorithm will continue until no further deletions are possible. One way to remove pixels:  At each step, find all foreground pixels which are 4-simple, and delete them all. BUT…. They are all 4-simple ! Deleting them all will thus remove the object completely. 0 0 0 0 1 1 1 1 0 0 0 0

16 16 Zhang-Suen Skeletonization Algorithm An extra test for deletability needed to avoid deleting too many pixels. Two options:  Subiteration: providing a step-wise algorithm, which changes the test for deletability at each step  Subfield: applying a different test for deletability according to where the pixel lies on the image grid. Z-S algorithm (subiteration)  For odd iterations, delete only pixels which are on the right hand side, or bottom of an object, or on a north-west corner.  For even iterations, delete only pixels which are on the left hand side, or top of an object, or on a south-east corner.

17 17 Zhang-Suen Algorithm Delete all flagged pixels. Continue until there are no more deletable pixels in two successive iterations. Step N Flag a foreground pixel p=1 to be deletable if 1. 2  B(p)  6 2. X(p)=1 3.If N is odd, then p2 p4 p6 = 0 p4 p6 p8 = 0 4. If N is even, then p2 p4 p8 = 0 P2 p6 p8 = 0 If N is odd, then p 4 =0, or p 6 =0, or p 2 =p 8 =0 If N is even, then p 2 =0, or p 8 =0, or p 4 =p 6 =0 p 1 p 2 p 3 p 8 p p 4 p 7 p 6 p 5

18 18 Example Step 1 The boxed pixels show those which will be deleted by steps 1 If N is odd, delete only pixels with bg pixels (1) on the right hand side, or (2) bottom of an object, or (3) on a north-west corner

19 19 Example (con ’ d) Step 2 If N is even, delete only pixels with bg pixels (1) on the left hand side, or (2) top of an object, or (3) on a south-east corner.

20 20 Example (con ’ d) Skeleton: the unboxed foreground pixels in the right hand diagram

21 21 How about this one? 0000 0110 0110 0000 The algorithm is not flawless!!!

22 22 Guo-Hall Skeletonization An example of subfield algorithm. Method:  Imagining image grid labeled with 1s and 2s in a chessboard configuration:  Alternating between pixels labeled 1 and pixels labeled 2 from step to step until no more deletions.  For a foreground pixel in consideration, if C(p)=1 and B(p)>1, flag it as deletable. 1212… 2121… 1212… 2121… ………… …

23 23 Example...........12121.....21212.....12121.....21212.....12121.....21212121..12121212..21212121..12121212..21212121........... Step 1: C(p)=1 B(p)>1

24 24 Example (con ’ d) Step 2:............2.2......21212......212......21212......212......21212.2....2121212..2121212....2121212..2.2.212............ C(p)=1 B(p)>1 ?

25 25 Distance Transform Skeletonization Review: what is distance transform? How can it achieve skeletonization?  Apply the distance transform to the image negative  The skeleton consists of those pixel(i,j) for which

26 26 Aside … Any other applications for distance transform?

27 27 Summary Concept of skeletonization Few algorithms:  Zhang-Suen  Guo-Hall  Distance transform


Download ppt "Digital Image Processing Lecture 13: Image Topology - Skeletonization Prof. Charlene Tsai."

Similar presentations


Ads by Google