Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.
-
Upload
johnathan-booth -
Category
Documents
-
view
216 -
download
2
Transcript of Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.
![Page 1: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/1.jpg)
Morphological Processing
Heejune Ahn, SeoulTech
Last updated 2015. May. 19
![Page 2: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/2.jpg)
Outline Introduction
binary Image & terminology Operation
Structuring element Dilation & erosion Opening & Closing
Application Boundary Extraction Connected components Extraction Region Filling Skeletonization
![Page 3: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/3.jpg)
1. Introduction Morphology
Concept
Morphological processing Extract ‘structural’ information image model = structure + texture(details) ‘simplification’ for easier understanding
Set-theory based
Set (image pixels) Set (structure)
C
operator
Set (image pixels)
morphology
structure
form linguistic
biology
![Page 4: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/4.jpg)
2.Binary image binary image
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
![Page 5: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/5.jpg)
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
Set (image pixels)
![Page 6: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/6.jpg)
4. Dilation & erosion Dilation & erosion
All other operation is defined by these two. Properties
Dilation Erosion
definition 1 if any neighbor = 10 o. w.
0 if any neighbor = 00 o. w.
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
![Page 7: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/7.jpg)
illustration
Fully connected FGs only SURIVE!
Fully connected BGs only SURIVE!
![Page 8: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/8.jpg)
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; 0 1 0 ] strel(‘shape’, ‘parameters’)
E.g. strel(‘square’, ‘4’) Special ‘strel’ object, not matlab array
![Page 9: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/9.jpg)
6. SE decomposition SE decomposition
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)
![Page 10: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/10.jpg)
7. Effects & uses of dilation & erosion Effects
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
![Page 11: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/11.jpg)
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
![Page 12: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/12.jpg)
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
![Page 13: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/13.jpg)
Illustration
![Page 14: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/14.jpg)
9. Boundary extraction
Thickness of boundary With different structuring elements Ex8.7 & F8.11
In MATLAB bwperim(img): 1-pixel thick boundary extraction
![Page 15: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/15.jpg)
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.
![Page 16: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/16.jpg)
Algorithm-2 Repeat until no more FG pixels Choose any unlabeled pixel
MATLAB [img, num] = Bwlabel(bimg) : labeling binary img Ex8.8 & F8.12
![Page 17: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/17.jpg)
11. Region filling Holes (of background pixels)
often remains after segmentation process often needs to be filled.
Example
Hole
Object/Boundary
One object is filled All objects are filled
![Page 18: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/18.jpg)
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
![Page 19: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/19.jpg)
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.
![Page 20: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/20.jpg)
Second, miss in BG, by erosion Done by logical complement images.
![Page 21: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/21.jpg)
Finally, combining two constraints/results
Hit-and-miss is better expression subsections not union!
![Page 22: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/22.jpg)
Ex8.9 & F8.18
MATLAB imhitmiss(A, B1, B2) : exact & non-exact match
![Page 23: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/23.jpg)
Generalized hit-or-miss 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.
![Page 24: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/24.jpg)
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”
0 0 0
1 1 0
0 1 0
1 1 1
0 0 1
0 0 1
-1 -1 -1
1 1 -1
0 1 -1
Same as above more forgiving
0 -1 -1
0 1 -1
0 0 0
![Page 25: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/25.jpg)
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)
![Page 26: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/26.jpg)
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
![Page 27: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/27.jpg)
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.
![Page 28: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/28.jpg)
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
![Page 29: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/29.jpg)
Ex. 8.12 mask = imread marker = imerode recon = imreconstruct
(marker, mask)
MASK (original)
Marker (Eroded, survived points ) Openning (reconstructed)
![Page 30: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/30.jpg)
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
![Page 31: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/31.jpg)
16&17. Gray scale erosion Extension of binary to gray-scale image
Erosion 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)
![Page 32: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/32.jpg)
Ex. Input image
Gray scale erosion
Gray scale dilation?
![Page 33: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/33.jpg)
18. Flat structuring element Flat Structuring
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?
![Page 34: Morphological Processing Heejune Ahn, SeoulTech Last updated 2015. May. 19.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ede5503460f94beea98/html5/thumbnails/34.jpg)
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
Subtract illumination
Opening (15x15) Contrast extension