450 likes | 493 Views
Digital Image Processing. Mathematical Morphology. Lecture 14 Course book reading: GW 9.1-4. Lucia Ballerini. Mathematical Morphology. mathematical framework used for: pre-processing noise filtering, shape simplification, ... enhancing object structure
E N D
Digital Image Processing Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini
Mathematical Morphology • mathematical framework used for: • pre-processing • noise filtering, shape simplification, ... • enhancing object structure • skeletonization, convex hull... • segmentation • watershed,… • quantitative description • area, perimeter, ...
Set theory A is a set in Z2 a=(a1,a2) is an element in A: aA a=(a1,a2) is not an element in A: aA empty set: set specified using { }, e.g., C={w|w=-d, for dD} every element in A is also in B (subset): AB
Set theory union of A and B: C=AB={c|cA or cB} AB intersection of A and B: C=AB={c|cA and cB} AB disjoint/mutually exclusive: AB=
Set theory complement of A: AC={w|wA} AC difference of A and B: A-B={w|wA,wB}=ABC A-B
Set theory reflection of A: Â={w|w=-a, for aA} Â translation of A by a point z=(z1,z2): (A)z={c|c=a+c, for aA} (A)z
Logical operations • pixelwise combination of images • AND, OR, NOT
A B NOT A A AND B A OR B A XOR B
Structuring element (SE) • small set to probe the image under study • for each SE, define origo • SE in point p: origo coincides with p • shape and size must be adapted to geometric properties for the objects
Basic idea • in parallel for each pixel in binary image: • check if SE is ”satisfied” • output pixel is set to 0 or 1 depending on used operation pixels in output image if check is: SE fits
origo How to describe SE • many different ways! • information needed: • position of origo for SE • positions of elements belonging to SE line segment line segment (origo is not in SE) line segment (origo is not in SE) pair of points (separated by one pixel)
Basic morphological operations shrink • erosion • dilation • combine to • opening • closening grow • keep general shape but smooth with respect to • object • background
Erosion • Does the structuring element fit the set? erosion of a set A by structuring element B: all z in A such that B is in A when origin of B=z shrink the object
Erosion SE=
Erosion SE=
Dilation • Does the structuring element hit the set? dilation of a set A by structuring element B: all z in A such that B hits A when origin of B=z grow the object
Dilation SE=
Dilation SE=
notation if SE is symmetric with respect to its origin (almost) only symmetric SEs in GW!!
Duality erosion and dilation are dual with respect to complementation and reflection note! the operations are not self dual
A A⊖B (A⊖B)C AC AC⊕B
useful • erosion • removal of structures of certain shape and size, given by SE • dilation • filling of holes of certain shape and size, given by SE
Combining erosion and dilation WANTED: remove structures / fill holes without affecting remaining parts SOLUTION: combine erosion and dilation (using same SE)
input: squares of size 1x1, 3x3, 5x5, 7x7, 9x9, and 15x15 pixels erosion: SE=square of size 13x13 dilation: SE=square of size 13x13
Opening erosion followed by dilation, denoted ∘ • eliminates protrusions • breaks necks • smoothes contour
Opening B= A∘B A⊖B A
Opening B= A∘B A⊖B A
Opening: roll ball(=SE) inside object see B as a ”rolling ball” boundary of A∘B = points in B that reaches farthest into A when B is rolled inside A
Closing dilation followed by erosion, denoted • smooth contour • fuse narrow breaks and long thin gulfs • eliminate small holes • fill gaps in the contour
Closing B= A B A⊕B A
Closing B= A B A⊕B A
Closing: roll ball(=SE) outside object see B as a ”rolling ball” boundary of AB = points in B that reaches farthest into A when B is rolled outside A
Properties • opening • A∘B subset/image of A • CD C∘B D∘B • (A∘B)∘B= A∘B • closing • A subset/image of AB • CD CB DB • (AB)B= AB Note: idempotent repeated openings/closings has no effect!
Duality opening and closing are dual with respect to complementation and reflection
A A∘B (A∘B)C AC ACB
Uselful: open & close A • opening of A • removal of small protrusions, thin connections, … closing of A removal of holes
Application:filtering • erode • A⊖B 2. dilate (A⊖B)B= A∘B 4. erode ((A∘B)B)⊖B= (A∘B)B 3. dilate (A∘B)B
Hit-or-Miss Transformation ⊛ (HMT) find location of one shape among a set of shapes ”template matching” composite SE: object part (B1) and background part (B2) does B1fits the object while, simultaneously, B2 misses the object, i.e., fits the background?
Z A=XY Z Y W W-X X A⊖X AC⊖(W-X) A⊛X=(A⊖B1)(Ac⊖B2)
Hit-or-Miss Transformation ⊛ (HMT) find location of one shape among a set of shapes B=(B1,B2) B1=X B2=W-X W W-X
B1 B2 B2 B2 B2 use HMT endpoints isolated points B1 B2