1 / 29

Image Topology ( Part 3 )

SCM3511 Image Processing 2 , Week 5. Image Topology ( Part 3 ). Dr. Bai-ling Zhang School of Computer Science & Mathematics Victoria University of Technology. Skeletonization: Example.

Download Presentation

Image Topology ( Part 3 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SCM3511 Image Processing 2, Week 5 Image Topology (Part 3) Dr. Bai-ling Zhang School of Computer Science & Mathematics Victoria University of Technology

  2. Skeletonization: Example Skeleton of a binary object: a collection of lines and curves whichencapsulate the size/shape of the object. Application Example: hand gesture recognition

  3. Skeletonization: Example Application Example: handwriting digits recognition

  4. Skeletonization: Example Application: human motion analysis skeleton video image motion detection

  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. 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 changingthe connectivity 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. Example 2 A non-deletable pixel: removes a hole Example 3 A non-deletable pixel: disconnects an object

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

  9. Check for deletability for 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. Check for deletability for a pixel • 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 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) = 1 B(p) = 5 A(p) = 2 C(p) = 2 B(p) = 4

  11. •• o • • • o o • •• o • • • o o • 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* C(p)=1 A(p)=2 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 •• o • • • o o • • 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.

  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 pixelp 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 p1p2p3 p8pp4 p7p6p5 p1, p2, p3, p4, p5, p6, p7, p8, p1 • 1 0 • 0 p 0 • 0 1 1 X(p)=2 1, 1, 0, 0, 1, 1, 0, 0, 1

  13. Calculating A(p) • 1 0 • 1 P 1 • 0 0 1 1, 1, 0, 1, 1, 0, 0, 1, 1 X(p)=2 • 1 1 • 1 P 1 • 1 0 0 X(p)=1 1, 1, 1, 1, 0, 0, 1, 1, 1 • 1 1 • 0 P 0 • 1 0 1 X(p)=3 1, 1, 0, 0, 1, 0, 1, 0, 1

  14. Calculating crossing number in Matlab • A matrix 3x3 matrix a in Matlab can be indexed using single indexing as: a(1) a(4) a(7) a(2) a(5) a(8) a(3) a(6) a(9) • Create two sequences: (1). The neighbouring pixels in clockwise order: >>p=[a(1) a(4) a(7) a(8) a(9) a(6) a(3) a(2)]; (2) The neighbouring pixels starting at a(4): >> pp =[p(2:8) p(1)];

  15. Calculating crossing number in Matlab So pp(i) =p(i+1) with pp(8)=p(1). A “0,1” is counted if for any i with , we have p(i)=0 and pp(i)=1. This will occur if and only if (1-p(i))*pp(i) is equal to 1. >> crossnum = sum((1-p).*pp);

  16. Calculating C(p) in Matlab p1p2p3 p8pp4 p7p6p5 •• o o • o o •• •• o • • • o o •

  17. 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…. 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 They are all 4-simple ! Deleting them all will thus remove the object completely.

  18. Zhang-Suen skeletonization algorithm • An extra test for deletability needed to avoid deleting too many pixels. • Two options: • Provide a step-wise algorithm, and change the test for deletability • at each step • Apply a different test for deletability according to where the pixel • lies on the image grid. Z-S algorithm 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.

  19. Zhang-Suen algorithm • Step N • Flag a foreground pixel p=1 to be deletable if • 2B(p)6 • X(p)=1 • 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 p4=0, or p6=0, or p2=p8=0 If N is even, then p2=0, or p8=0, or p4=p6=0 Delete all fagged pixels. Continue until there are no more deletable pixels in two successive iterations.

  20. Item 1 ensures that we don't delete pixels which have only one neighbour, or have seven or more. Example:Step 1 If N is odd, delete only pixels which are (1) on the right hand side, or (2) bottom of an object, or (3) on a north-west corner The boxed pixels show those which will be deleted by steps 1

  21. Step 2: If N is even , delete only pixels which are (1) on the left hand side, or (2) top of an object, or (3) on a south-east corner.

  22. Skeleton: the unboxed foreground pixels in the right hand diagram

  23. Matlab Implementation of Z-S algorithm one for the odd iterations, one for the even. • Set up lookup tables: • Apply these lookup tables alternately until there is no change in • the image for two successive iterations. • Manage this by keeping three images at any given time: • the current image, the previous image, and the last. • If the current and last images are equal, we stop. Otherwise, • push the images back: previous last current previous current applylut(current,lut)

  24. Matlab Implementation of Z-S algorithm

  25. Example: • First create a binary image • L= zeros(12,10); • L(2:11,2:6)=1; • L(7:11,7:9)=1; • Then apply the zs algorithm: • LS=zs(L)

  26. Example

More Related