Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE465: Introduction to Digital Image Processing 1 What is in Common?

Similar presentations


Presentation on theme: "EE465: Introduction to Digital Image Processing 1 What is in Common?"— Presentation transcript:

1 EE465: Introduction to Digital Image Processing 1 What is in Common?

2 EE465: Introduction to Digital Image Processing 2 A BW Image and Its Inverse

3 EE465: Introduction to Digital Image Processing 3 Application (I): FAX Document

4 EE465: Introduction to Digital Image Processing 4 Application (II): Scanned Documents

5 EE465: Introduction to Digital Image Processing 5 Application (III): Biometrics

6 EE465: Introduction to Digital Image Processing 6 Application (IV): Image Matting figure-ground segmentation in computer vision

7 EE465: Introduction to Digital Image Processing 7 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

8 EE465: Introduction to Digital Image Processing 8 Binary Images Images only consist of two colors (tones): white or black Numerical example (image of a square block) 0 0 0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0

9 EE465: Introduction to Digital Image Processing 9 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 0 0 0 0 0 0 1 1 f(m,n) L={(3,3),(3,4),(4,3),(4,4)} location of white pixels It is often more convenient to consider the set representation than the matrix representation for binary images matrix representationset representation

10 EE465: Introduction to Digital Image Processing 10 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

11 EE465: Introduction to Digital Image Processing 11 Set Theory Review Think of sets A and B as the collections of spatial coordinates

12 EE465: Introduction to Digital Image Processing 12 Translation Operator Example

13 EE465: Introduction to Digital Image Processing 13 Reflection Operator Example B B ^

14 EE465: Introduction to Digital Image Processing 14 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

15 EE465: Introduction to Digital Image Processing 15 Structuring Element B Definition: a set of local neighborhood with specified origin Examples origin B1B1 B2B2 Note: different structuring element leads to different filtering result

16 EE465: Introduction to Digital Image Processing 16 mask B X Y Definition Example Dilation or

17 EE465: Introduction to Digital Image Processing 17 X XcaXca B={a,b,c} a=(0,0),b=(0,-1),c=(-1,0) origin XcbXcb B XccXcc Illustration by Animation

18 EE465: Introduction to Digital Image Processing 18 mask B X Y Definition Example Erosion Y=X B _

19 EE465: Introduction to Digital Image Processing 19 mask B X Y Illustration By Animation

20 EE465: Introduction to Digital Image Processing 20 (X B) c _ =X c  B ^ Duality Property* Proof: (X B) c _ ={z | B z  A } c = {z | B z  A c =  } c = {z | B z  A c  } =X c  B ^

21 EE465: Introduction to Digital Image Processing 21 X B XcXc B ^ (X B) c _ X B _ XcBXcB ^ Example

22 EE465: Introduction to Digital Image Processing 22 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

23 EE465: Introduction to Digital Image Processing 23 (X B) B _ + Definition mask B X _ + Opening Operator Example

24 EE465: Introduction to Digital Image Processing 24 Geometric Interpretation of Opening Operator

25 EE465: Introduction to Digital Image Processing 25 Definition (X B) B+ _ _ + mask B X Closing Operator Example

26 EE465: Introduction to Digital Image Processing 26 Geometric Interpretation of Closing Operator

27 EE465: Introduction to Digital Image Processing 27 Properties of Opening and Closing Operators* Opening Closing ● ● ● ● ● ●

28 EE465: Introduction to Digital Image Processing 28 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

29 EE465: Introduction to Digital Image Processing 29 A Little Game of Matching Templates A B

30 EE465: Introduction to Digital Image Processing 30 Illustration by a Simpler Case Template B How to find the match of A in X using a computer? X Hit: the southwest quadrant must be black in X origin Hit: the other three quadrants must be white in X Hit: the southwest quadrant must be black in X Hit: the other three quadrants must be black in X c

31 EE465: Introduction to Digital Image Processing 31 Matching via Hit-or-Miss Template B origin Hit: the southwest quadrant must be black in X Hit: the other three quadrants must be black in X c Template B 1 Template B 2 X 1 =X B 1 _ X 2 =X c B 2 _ To satisfy both conditions, we need to take the intersection of X 1 and X 2

32 EE465: Introduction to Digital Image Processing 32 mask B 1 (MATLAB function: bwhitmiss) (X B 1 )  (X c B 2 ) __ X B= * HitMiss mask B 2 origin mask B x xx MATLAB 0 -1 -1 11 -1 0 1 0 Hit-or-Miss Operator Definition Structuring element example Why ? _ Why complement? Why intersection?

33 EE465: Introduction to Digital Image Processing 33 X Example 1 mask B 1 mask B 2 origin XcXc X c B 2 X B 1 __ X B *

34 EE465: Introduction to Digital Image Processing 34 mask B 1 mask B 2 mask B MATLAB -1 -1 -1 11 -1 Example 2 origin X XcXc X c B 2 X B 1 __ X B * Now, take the intersection and note that only two points Remain (highlighted by red)

35 EE465: Introduction to Digital Image Processing 35 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

36 EE465: Introduction to Digital Image Processing 36 “BAD EXAMPLE” Y=X-(X B) _ mask B XX B _

37 EE465: Introduction to Digital Image Processing 37 X-(X B) _ mask B XX B _ Boundary Extraction Example  X=X-(X B) _ Definition  X=(X B) – B? + How about Note that

38 EE465: Introduction to Digital Image Processing 38 XX X Image Example

39 EE465: Introduction to Digital Image Processing 39 Inner vs. Outer Boundary

40 EE465: Introduction to Digital Image Processing 40 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

41 EE465: Introduction to Digital Image Processing 41 P X Iterations: Y 0 =P Y k =(Y k-1  B)  X c, k=1,2,3… mask B Terminate when Y k =Y k-1,output Y k  X Idea: recursively expand the region around P but stop the expansion at the boundary of X Region Filling expansionstop at the boundary Why dilation? Why intersection with X c ?

42 EE465: Introduction to Digital Image Processing 42 XY0Y0 P Y0BY0B XcXc Y1Y1 Y1BY1B Y2Y2 Y2BY2B Y 3 =Y 2 Image Example

43 EE465: Introduction to Digital Image Processing 43 Additional Example P

44 EE465: Introduction to Digital Image Processing 44 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

45 EE465: Introduction to Digital Image Processing 45 Thinning thinning Intuitively, thinning finds the skeleton of a binary image (you will learn a different way of finding skeleton by distance transform later)

46 EE465: Introduction to Digital Image Processing 46 Thinning Algorithm Basic idea:  Use Hit-or-Miss operator as a sifter  Use multiple masks to characterize different patterns x x B2B2 xx B1B1 x x B3B3 x x B4B4 B6B6 xx B5B5 B7B7 B8B8 x x x x x x X 0 =X X k =(…( (X k-1  B 1 )  B 2 …  B 8 ) where X  B=X – X B * Stop the iteration when X k =X k-1 Why eight different B’s? Why hit-or-miss?

47 EE465: Introduction to Digital Image Processing 47 Image Example

48 EE465: Introduction to Digital Image Processing 48 Image Example (Con’t) Binary fingerprint image Skeleton image

49 EE465: Introduction to Digital Image Processing 49 Morphological Filtering: Skeletons* X kB=(((X B) B) … B) ____ k-fold Define S k (A)=(A kB)-(A KB) B __ and Then the skeleton of an image A is given by

50 EE465: Introduction to Digital Image Processing 50 Textbook Example*

51 EE465: Introduction to Digital Image Processing 51 Image Example* Binary fingerprint image Skeleton image

52 EE465: Introduction to Digital Image Processing 52 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)

53 EE465: Introduction to Digital Image Processing 53 Summary (Con ’ d) bwhitmiss(A,B) A&~(imerode(A,B)) region_fill.m bwmorph(A,’thin’);

54 EE465: Introduction to Digital Image Processing 54 What is Common?

55 EE465: Introduction to Digital Image Processing 55 One-Minute Survey If X={even integers}, Y={multiples of 6}, what is X-Y? How long did you spend on CA#1? What do you think of the pace of this course so far? What is the muddiest point in the last two weeks’ lectures? Do you mind my posting the class grade using the last 4-digit of your ID?

56 EE465: Introduction to Digital Image Processing 56 Binary Image Processing Introduction Set theory review Morphological filtering operators Erosion and dilation Opening and closing Hit-or-miss Boundary extraction Region-filling Thinning (for finding skeleton) Other processing algorithms Area calculation, finding connected components Skeleton finding via distance transform

57 EE465: Introduction to Digital Image Processing 57 Building New Pieces How to calculate the perimeter of a binary object A? Find the boundary first (MATLAB: bwperim(A)) How to calculate the area of a binary object A? MATLAB: bwarea or sum(sum(A)) Complication: what if there are multiple binary objects? (this relates to binary image analysis. MATLAB: bwlabel) How to get rid of small holes of a binary object? Recall region filling routine (MATLAB: bwareaopen)

58 EE465: Introduction to Digital Image Processing 58 Image Examples A label2rgb(bwlabel(A))bwareaopen(A,50)

59 EE465: Introduction to Digital Image Processing 59 Medial Axis Transform (a.k.a. Skeleton) What is medial axis? Examples 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

60 EE465: Introduction to Digital Image Processing 60 Distance Transform http://demonstrations.wolfram.com/DistanceTransforms/

61 EE465: Introduction to Digital Image Processing 61 Skeleton Algorithm Distance transform: find the distance from the nearest boundary for each point Skeleton is the set of points whose distance from the nearest boundary is locally maximum - initialization - iteration

62 EE465: Introduction to Digital Image Processing 62 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 1 2 2 3 2 2 1 x 0 (m,n) x 1 (m,n)x 3 (m,n) skeleton local maximum Example Skeleton Algorithm (Cont’d)

63 EE465: Introduction to Digital Image Processing 63 Image Example originalskeleton

64 EE465: Introduction to Digital Image Processing 64 Binary Image Processing Summary


Download ppt "EE465: Introduction to Digital Image Processing 1 What is in Common?"

Similar presentations


Ads by Google