470 likes | 559 Views
Explore mathematical tools for shape analysis in binary and grayscale images. Learn basic operations like reflection, dilation, erosion, and boundary detection. Discover techniques for noise removal and image manipulation.
E N D
Chapter 10: Mathematical Morphology • Provides mathematical tools for shape analysis in • both binaryandgrayscale images. • They are suitable to be implemented by hardware. • ◎ Basic Operations • ○Reflection • -- Reflects a set of pixels w.r.t. the origin 。 Example:
○ Translation • w: a displacement (a vector) 。 Example: w = (2,2) ○ Dilation : dilation of A by B B : a structuring element
。Example: can be obtained by replacing every x in A with a B
。 。Dilation has the effect of increasing the size of an shape 。 The origin of B may not be in B and it may be that
○ Erosion • Steps: (i) Move B over A, • (ii) Find all the placeswhere B fits • (iii) Mark the origin of B when fitting 。 Example:
。The origin of B • may not be in B • and 。Erosion thins an shape
Proof: From the definition of erosion, Its complement: If , then • ○ 。 Duality (Assigment)
◎ Boundary Detection • Let B: symmetric about its origin • The boundary of A • (i) Internal boundary: • -- pixels in A that are at its edge • (ii) External boundary: • -- pixels outside A that are next to it • (iii) Gradient boundary: • -- a combination of internal and external • boundary pixels
。 Example: external boundary Internal boundary gradient boundary
。 Real image Internal boundary external boundary gradient boundary
。 Example: • ○ Opening 1) 2)
。 Properties: • (i) • (ii) Idempotence: • (iii) (Assignment) (iv) Opening tends to (a) smooth image, (b) break narrow joins (c) remove thin protrusions
。 Example: • ○ Closing
。 Properties: • (i) • (ii) Idempotence: • (iii) • (iv) Closing tends to • (a) smooth image, (b) fuse narrow breaks • (c) thin gulfs, (d) remove small holes
Show ○ Relationship between opening and closing Proof: (Assign.)
Square • ◎ Removal of impulse (salt and pepper) noise Cross B=Cross B=Square • removes single black and white pixels • but enlarges holes (2) fills holes by dilating twice but enlarge the objects • reduces • the size by an erosion
○ Hit-or-Miss Transform -- Finding shapes : the shape to be found : fits around 。Example – find the square in an image A B = A: (i) (hit)
◎ Region filling • A: 8-connected boundary, p : a point within A
。Example: 。Real image
◎ Connected components • Let A: a collection of components • C: a component of A • p : a point in C • B : a structuring element • Using cross-shaped B to find 4-connected • components • square B to find 8-connected • components
。Example: 。Real image 3 × 3 Structuring element 11 ×11 Structuring element
◎ Skeletonization (thinning) Applications: OCR , fingerprint recognition, map digitization.
Optical Character Recognition (OCR) Fingerprint Recognition
Structuring element Final result
。 Real image • Square • structuring • element Cross structuring element
◎ Grayscale Morphology • ○Binary erosion: • (i) Move B over A, • (ii) Find all the placeswhere B fits • (iii) Mark the origin of B when fitting
For each p of A (i) Find its neighborhood according to the domain of B (ii) p = min{ }
。 Example: • The value of A(1+s, 1+t) – B(s, t) Minimum = 5
Final result:
。 Summary for the process of grayscale erosion: For each pixel p of A, (i) Lie the origin of B over p (ii) Find according to domain of B (iii) p = min{ }
。 Example: 5 × 5 square structuring element * Erosion decreases light areas in an image
○ Binary dilation For each p of A (i) Find its neighborhood according to the domain of B (ii) p = max{ }
Final result:
。 Summary for the process of grayscale dilation: For each pixel p of A, (i) Lie the origin of B over p (ii) Find according to domain of B (iii) p = max{ }
。 Example: 5 × 5 square structuring element *Dilation increases light areas in an image
◎ Relationship between grayscale erosion and dilation Let X, Y: matrices, e.g.,
○ Edge Detection 3 × 3 square 5 × 5 square
◎ Opening = erosion + dilation Closing = dilation + erosion 。 Example: 5 × 5 square structuring element Opening Closing