Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Image Processing

Similar presentations


Presentation on theme: "Binary Image Processing"— Presentation transcript:

1 Binary Image Processing
Introduction Set theory review Morphological filtering Erosion and dilation Opening and closing Hit-or-miss, boundary extraction, … Skeleton via distance transform

2 Binary Images Images only consist of two colors (tones): white or black Numerical example (image of a square block)

3 Binary Image Examples

4 Why are binary images special?
Since pixels are either white or black, the locations of white(black) pixels carry ALL information of binary images Example L={(3,3),(3,4),(4,3),(4,4)} location of white pixels f(m,n) matrix representation set representation It is often more convenient to consider the set representation than the matrix representation for binary images

5 Binary Image Processing
Introduction Set theory review Morphological filtering Erosion and dilation Opening and closing Hit-or-miss, boundary extraction, … Skeleton via distance transform

6 Set Theory Review Think of sets A and B as the collections of spatial coordinates

7 Translation Operator Example

8 Reflection Operator Example ^ B B

9 Binary Image Processing
Introduction Set theory review Morphological filtering Erosion and dilation Opening and closing Hit-or-miss, boundary extraction, … Skeleton via distance transform

10 Structuring Element B Definition: a set of local neighborhood with specified origin Examples origin B1 B2 Note: different structuring element leads to different filtering result

11 Dilation Definition or Example X Y mask B

12 Illustration by Animation
X origin B B={a,b,c} a=(0,0),b=(0,-1),c=(-1,0) Xca Xcb Xcc

13 Erosion Definition Y=X B _ Example X Y mask B

14 Illustration By Animation
mask B Y X

15 Theorem* _ ^ (X B)c =XcB _ (X B)c ^ Proof: ={z | Bz A }c
= {z | Bz Ac = }c = {z | Bz  Ac  } =Xc B ^

16 Example _ _ Xc X B (X B)c X B ^ B ^ XcB

17 Opening Operator _ Definition (X B) B + Example X _ mask B +

18 Geometric Interpretation of Opening Operator

19 Closing Operator _ Definition (X B) B + Example X + mask B _

20 Geometric Interpretation of Closing Operator

21 Properties of Opening and Closing Operators*
Closing

22 A Little Game of Matching
Templates A B

23 Illustration by a Simpler Case
How to find the match of A in X using a computer? Hit: the southwest quadrant must be black in X Hit: the other three quadrants must be white in X X Hit: the southwest quadrant must be black in X origin Hit: the other three quadrants must be black in Xc Template B

24 Matching via Hit-or-Miss
Hit: the southwest quadrant must be black in X origin _ Template B X1=X B1 Hit: the other three quadrants must be black in Xc Template B1 _ X2 =Xc B2 To satisfy both conditions, we need to take the Intersection of X1 and X2 Template B2

25 Hit-or-Miss Operator * _ _ _ X B= (X B1)(Xc B2) Hit Miss origin
Why ? Definition * (X B1)(Xc B2) Why complement? Why intersection? Hit Miss Structuring element example origin 1 -1 x x x mask B1 mask B2 mask B MATLAB (MATLAB function: bwhitmiss)

26 Example 1 _ _ X X B1 Xc B2 Xc origin X B * mask B1 mask B2

27 * -1 -1 -1 1 -1 1 1 -1 Example 2 mask B1 mask B2 mask B MATLAB _ _ X
origin 1 -1 Example 2 mask B1 mask B2 mask B MATLAB _ _ X X B1 Xc B2 Xc Now, take the intersection and note that only two points Remain (highlighted by red) X B *

28 Roadmap of Morphological Filtering
basic set operators (complement, union, intersection, difference) dilation/erosion operators closing/opening, Hit-or-Miss operators morphological filters/algorithms (boundary, region filling, thinning)

29 1. Boundary Extraction _ X=X-(X B) X=(X B) – B? + mask B _ X X B _
Definition X=X-(X B) How about Example X=(X B) – B? + mask B _ X X B _ X-(X B) MATLAB function: bwmorph(…,’remove’)

30 Image Example X X

31 2. Region Filling P X Idea: recursively expand the region around P but stop the expansion at the boundary of X Iterations: expansion stop at the boundary Y0=P mask B Why dilation? Why intersection with Xc? Yk=(Yk-1B)Xc, k=1,2,3… Terminate when Yk=Yk-1,output YkX

32 Image Example P X Y0 Y0B Xc Y1 Y1B Y2B Y2 Y3=Y2

33 Additional Example P

34 3. Thinning thinning Intuitively, thinning finds the skeleton of a binary image (you will learn a different way of finding skeleton by distance transform later)

35 Thinning Algorithm * X0=X Xk=(…( (Xk-1  B1)  B2 …  B8) Basic idea:
 Use Hit-or-Miss operator as a sifter  Use multiple masks to characterize different patterns x x x x x x x x x x x x x x x x B1 B2 B3 B4 B5 B6 B7 B8 X0=X Why eight different B’s? Why hit-or-miss? Xk=(…( (Xk-1  B1)  B2 …  B8) where X  B=X – X B * Stop the iteration when Xk=Xk-1

36 Image Example

37 Summary of Morphological Filtering
MATLAB codes circshift(A,z) fliplr(flipud(B)) ~A or 1-A A &~B imdilate(A,B) imerode(A,B) imopen(A,B) imclose(A,B)

38 Summary (Con’d) bwhitmiss(A,B) A&~(imerode(A,B)) region_fill.m
bwmorph(A,’thin’);

39 Binary Image Processing
Introduction Set theory review Morphological filtering Erosion and dilation Opening and closing Hit-or-miss, boundary extraction, … Skeleton via morphological filtering and distance transform

40 Medial Axis (Skeleton)
• Definition Suppose that a fire line propagates with constant speed from the contour of a connected object towards its inside, then all those points lying in positions where at least two wave fronts of the fire line meet during the propagation will constitute a form of a skeleton • Examples

41 Morphological Filtering: Skeletons
_ _ _ _ X kB=(((X B) B) … B) Define k-fold _ _ and Sk(A)=(A kB)-(A KB) B

42 Morphological Filtering: Skeletons
Then the skeleton of an image A is given by

43 Image Example

44 Skeleton Finding via Distance Transform
• Distance transform: find the distance from the nearest boundary for each point - initialization - iteration

45 Skeleton Finding via Distance Transform
• Skeleton is the set of points whose distance from the nearest boundary is locally maximum

46 Numerical Example 2 2 3 local maximum x0(m,n) x1(m,n) x3(m,n) skeleton

47 Image Example original skeleton MATLAB code: y=bwmorph(x,’skel’,inf);

48 Image Example (Con’t) Binary fingerprint image Skeleton image


Download ppt "Binary Image Processing"

Similar presentations


Ads by Google