Presentation is loading. Please wait.

Presentation is loading. Please wait.

Morphological Processing

Similar presentations


Presentation on theme: "Morphological Processing"— Presentation transcript:

1 Morphological Processing
Heejune Ahn, SeoulTech Last updated May. 19

2 Outline Introduction Operation Application binary Image & terminology
Structuring element Dilation & erosion Opening & Closing Application Boundary Extraction Connected components Extraction Region Filling Skeletonization

3 1. Introduction C Morphology Morphological processing Set-theory based
Concept Morphological processing Extract ‘structural’ information image model = structure + texture(details) ‘simplification’ for easier understanding Set-theory based morphology structure form linguistic biology C Set (image pixels) Set (image pixels) Set (structure) operator

4 2.Binary image binary image Object and connected
Image with two values (1/0, true/false, on/off) foreground vs background pixel foreground pixel: value = 1 background pixel: value = 0 Object and connected connected foreground pixels 4/8 connected Binary against gray image No Texture info(variation of values) interested only in shape, size, location of object

5 Set (structuring element)
3. Structuring elements Morphological operation target pixel <= operation with neighbor pixels Structuring elements size(odd/even), symmetric/not choice of S.E. depends on application Main topics in M.P. Set (image pixels) Set (structuring element) C operator

6 4. Dilation & erosion Dilation & erosion Properties
All other operation is defined by these two. Properties Dilation Erosion definition 1 if any neighbor = 1 0 o. w. 0 if any neighbor = 0 visual BG pixels remain if the structure element is included FG pixels remain if the structure element is included effects expansion of the object shrink of the object

7 Fully connected FGs only SURIVE!
illustration Fully connected FGs only SURIVE! Fully connected BGs only SURIVE!

8 5. Dilation & Erosion in MATAB
imerode(bw, se) & Imdilate(bw, se) bw (b/w image), se (structuring element) Return result b/w image structuring element defintion MATLAB array E.g. se = [0 1 0; 1 1 1; ] strel(‘shape’, ‘parameters’) E.g. strel(‘square’, ‘4’) Special ‘strel’ object, not matlab array

9 6. SE decomposition SE decomposition In MATLAB
any operations = successive erosions & dilations Computational efficiency Operation complexity ~ # of SE pixels E.g. 5-pixel square = 2 times of 3 pixels square Computational gain = (5*5)/(2*(3*3)) = 25/18 In MATLAB ‘strel’ shows the information E.g. se3 = strel(‘disk’, 5); ‘getsequence(se)’ returns set of decomposition E.g. decomp = getsequence(se3); imerose/imdilate etc does it internally (w. strel obj)

10 7. Effects & uses of dilation & erosion
Increase (dilation)/reduce (erosion) at boundary Caution Not reversible process ( ). Why? careful choice of SE Application to segmentation Breaks in edge boundary Dilation till closed contour Region filling Erode the boundary back

11 Tips: apply the same size (times)
Another example Tips: apply the same size (times) Same # of dilation and erosion Particle Counting & sizing: do yourself. Thresholding Horizontal-erosion vertical-erosion Dilation * 2

12 8. Opening & closing Opening vs closing Interpretation
Erosion and dilation is ir-reversible. first operation is key, the next operation is to recover the size Simplification of boundary Opening Closing definition visual Dilation after erosion Erosion after dilation effects Removal of small, isolated objects Changing small holes into FB (fill)

13 Illustration

14 9. Boundary extraction In MATLAB Thickness of boundary
With different structuring elements Ex8.7 & F8.11 In MATLAB bwperim(img): 1-pixel thick boundary extraction

15 10. Extracting connected compoents
Labeling the connected objects Background = 0, first obj = 1, and so on Algorithm-1 Scan from top-left to bottom-right if all neighbors = 0 or not labeled, assign a new label p. If only one FG neighbor, assign p to the pixel If multiple FG neighbors, equivalent resolution and assign smaller label.

16 Algorithm-2 MATLAB Repeat until no more FG pixels
Choose any unlabeled pixel MATLAB [img, num] = Bwlabel(bimg) : labeling binary img Ex8.8 & F8.12

17 11. Region filling Holes (of background pixels) Example
often remains after segmentation process often needs to be filled. Example Object/Boundary Hole One object is filled All objects are filled

18 Restrict growing outside of boundary
Algorithm First, file hole region choose a hole X0 = {the hole} Find hole region Then, fill/combine the hole region: In MATLAB imfill(bwimg,’hole’), imfill(bwimg[,location, conn]) Restrict growing outside of boundary Extend the hole region

19 12. Hit-or-miss transform
Detect a specific shape in a image (boundary) Exactly the same pattern both in FG & BG. Algorithm First, find hit in FG by erosion.

20 Second, miss in BG, by erosion
Done by logical complement images.

21 Hit-and-miss is better expression
Finally, combining two constraints/results Hit-and-miss is better expression subsections not union!

22 Ex8.9 & F8.18 MATLAB imhitmiss(A, B1, B2) : exact & non-exact match

23 Generalized hit-or-miss
Detect only the exactly same shape Generalization (relaxation) Practice needs ‘strict on FG but less strict in BG’ Less sensitive to noise and small variations.

24 13. Relaxing constraints forgiving structure in MATLAB(E8.10& F8.20)
imhitmiss(A, B1, B2) imhitmiss(A, interval) Interval: 1 for FG, -1 for BG, 0 for “don’t care” 1 1 -1 1 -1 1 Same as above more forgiving

25 Thinning If the foreground and background pixels in the structuring element exactly match foreground and background pixels in the image, then the image pixel underneath the origin of the structuring element is set to background (zero)

26 14. Skeletonization Skeleton
Reduce an object into bare-bone(minimal level) Topological information Nodes, branches (length), angles of branches Weakness Sensitive to the small change/irregularity in morphology E.g.) Not exact circle => not a point

27 Definition of skeleton
Pixels of same distance from the boundary Prairie-fire analogy Set a fire on the boundary and all fire spread at the same speed, then the skeleton is point where all fires met. Implementation of skeleton By thinning until no more thinning is possible.

28 15. Opening by reconstruction
Anisotropy effect (prob. in opening) Opening remove the details of boundary Dilation changes the boundary similar to “SE.” Distortion when original shape too different from SE Algorithm (reconstruct to original shape) M: mask = original image (shape) An : marker: eroded image (survived points) B : simple 3x3 SE Iterate Until

29 Ex. 8.12 mask = imread marker = imerode recon = imreconstruct
(marker, mask) MASK (original) Marker (Eroded, survived points ) Openning (reconstructed)

30 16-20. Grey-scale operation
Extension of binary operations Not covered in lecture 16. grey-scale erosion and dilation 17. grey-scale structuring elements: general 18. grey-scale erosion dilation with flat structuring elements 19.Grey-scale opening and closing 20. top-hat transform

31 16&17. Gray scale erosion Extension of binary to gray-scale image
Min(A – B) over region B with center location Dilation Max(A + B) over region B with center location General structuring element Array of 0 or 1s (if structuring elements or not) Array of numbers (used for calculation)

32 Ex. Input image Gray scale erosion Gray scale dilation?

33 18. Flat structuring element
Vb = zeros(), all elements = 0 Erosion with flat SE Min filtering with window of SE Dilation with flat SE Max filtering with windows of SE Morphological gradient Dilation - Erosion Boundary?

34 19. Gray scale Opening & Closing
Comparison Ex 8.15: illumination compensation Opening Closing Binary Erase small objects Fill small holes Gray scale Suppress small brightness parts Suppress small darkness parts Opening (15x15) Contrast extension Subtract illumination


Download ppt "Morphological Processing"

Similar presentations


Ads by Google