640 likes | 863 Vues
What is in Common?. A BW Image and Its Inverse. Application (I): FAX Document. Application (II): Scanned Documents. Application (III): Biometrics. Application (IV): Image Matting. figure-ground segmentation in computer vision. Binary Image Processing. Introduction Set theory review
E N D
What is in Common? EE465: Introduction to Digital Image Processing
A BW Image and Its Inverse EE465: Introduction to Digital Image Processing
Application (I): FAX Document EE465: Introduction to Digital Image Processing
Application (II): Scanned Documents EE465: Introduction to Digital Image Processing
Application (III): Biometrics EE465: Introduction to Digital Image Processing
Application (IV): Image Matting figure-ground segmentation in computer vision EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
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 0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 255 255 255 255 0 0 0 0 255 255 255 255 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 EE465: Introduction to Digital Image Processing
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 0 0 0 0 1 1 0 0 1 1 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 EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
Set Theory Review Think of sets A and B as the collections of spatial coordinates EE465: Introduction to Digital Image Processing
Translation Operator Example EE465: Introduction to Digital Image Processing
Reflection Operator Example ^ B B EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
Dilation Definition or Example X Y mask B EE465: Introduction to Digital Image Processing
Illustration by Animation X origin B B={a,b,c} a=(0,0),b=(0,-1),c=(-1,0) Xca Xcb Xcc EE465: Introduction to Digital Image Processing
_ Y=X B Erosion Definition Example X Y mask B EE465: Introduction to Digital Image Processing
Illustration By Animation mask B Y X EE465: Introduction to Digital Image Processing
Duality Property* _ ^ =XcB (X B)c Proof: _ (X B)c ={z | Bz A }c = {z | Bz Ac = }c = {z | Bz Ac } =XcB ^ EE465: Introduction to Digital Image Processing
Example _ _ Xc X B (X B)c X B ^ B ^ XcB EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
_ _ + + Opening Operator Definition (X B) B Example X mask B EE465: Introduction to Digital Image Processing
Geometric Interpretation of Opening Operator EE465: Introduction to Digital Image Processing
_ _ + + Closing Operator Definition (X B) B Example X mask B EE465: Introduction to Digital Image Processing
Geometric Interpretation of Closing Operator EE465: Introduction to Digital Image Processing
Properties of Opening and Closing Operators* Opening ● ● ● ● Closing ● ● EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
A Little Game of Matching Templates A B EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
_ _ 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 EE465: Introduction to Digital Image Processing
_ _ _ Hit-or-Miss Operator Why ? X B= (X B1)(Xc B2) * Definition Why complement? Why intersection? Hit Miss Structuring element example origin • 0 -1 -1 • 1 -1 • 0 1 0 x x x mask B1 mask B2 mask B MATLAB (MATLAB function: bwhitmiss) EE465: Introduction to Digital Image Processing
_ _ Example 1 X X B1 Xc B2 Xc origin X B * mask B1 mask B2 EE465: Introduction to Digital Image Processing
_ _ origin • -1 -1 -1 • 1 -1 • 1 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 * EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
_ _ “BAD EXAMPLE” mask B X X B Y=X-(X B) EE465: Introduction to Digital Image Processing
_ _ _ + Boundary Extraction X=X-(X B) Definition How about Example X=(X B) – B? mask B X X B X-(X B) Note that EE465: Introduction to Digital Image Processing
Image Example X X EE465: Introduction to Digital Image Processing
Inner vs. Outer Boundary EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
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-1B)Xc, k=1,2,3… Terminate when Yk=Yk-1,output YkX EE465: Introduction to Digital Image Processing
Image Example P Y0B X Y0 Xc Y1 Y1B Y2B Y2 Y3=Y2 EE465: Introduction to Digital Image Processing
Additional Example P EE465: Introduction to Digital Image Processing
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 EE465: Introduction to Digital Image Processing
Thinning thinning Intuitively, thinning finds the skeleton of a binary image (you will learn a different way of finding skeleton by distance transform later) EE465: Introduction to Digital Image Processing
Thinning Algorithm * Use Hit-or-Miss operator as a sifter Basic idea: Use multiple masks to characterize different patterns x x x x x x x x x x x x x x x x B5 B6 B7 B8 B4 B1 B2 B3 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 EE465: Introduction to Digital Image Processing
Image Example EE465: Introduction to Digital Image Processing
Image Example (Con’t) Skeleton image Binary fingerprint image EE465: Introduction to Digital Image Processing
Morphological Filtering: Skeletons* _ _ _ _ _ _ X kB=(((X B) B) … B) Define k-fold Sk(A)=(A kB)-(A KB) B and Then the skeleton of an image A is given by EE465: Introduction to Digital Image Processing
Textbook Example* EE465: Introduction to Digital Image Processing