ecg782 multidimensional
play

ECG782: Multidimensional Digital Signal Processing Morphology - PowerPoint PPT Presentation

Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu ECG782: Multidimensional Digital Signal Processing Morphology http://www.ee.unlv.edu/~b1morris/ecg782/ 2 Outline Mathematical Morphology Erosion/Dilation Opening/Closing


  1. Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu ECG782: Multidimensional Digital Signal Processing Morphology http://www.ee.unlv.edu/~b1morris/ecg782/

  2. 2 Outline • Mathematical Morphology • Erosion/Dilation • Opening/Closing • Grayscale Morphology • Morphological Operations • Connected Components

  3. 3 Morphological Image Processing • Filtering done on binary images ▫ Images with two values [0,1], [0, 255], [black,white] ▫ Typically, this image will be obtained by thresholding  𝑕 𝑦, 𝑧 = 1 𝑔 𝑦, 𝑧 > 𝑈 𝑔(𝑦, 𝑧) ≤ 𝑈 0 • Morphology is concerned with the structure and shape • In morphology, a binary image is filtered with a structuring element 𝑡 and results in a binary image • Matlab Notes ▫ http://www.mathworks.com/help/images/pixel- values-and-image-statistics.html

  4. 4 Mathematical Morphology • Tool for image simplification while maintaining shape characteristics of objects ▫ Image pre-processing  Noise filtering, shape simplification ▫ Enhancing object structure  Skeletonizing, thinning, thickening, convex hull ▫ Segmenting objects from background ▫ Quantitative description of objects  Area, perimeter, moments

  5. 5 Set Representation for Binary Images • The language of mathematical • Morphological transformation morphology is set theory Ψ ▫ A set represents an object in ▫ Relationship between image 𝑌 and structuring element 𝐶 an image • Example ▫ Structuring element 𝐶 is expressed with respect to a 1,0 , 1,1 , 1,2 , ▫ 𝑌 = local origin 𝑃 2,2 , 0,3 , 0,4 • Relationship computed as 𝐶 is moved across the image in a raster scan ▫ Similar to filtering but with zero/one output ▫ Current pixel corresponds to 𝑃

  6. 6 Set Reflection/Translation • Reflection = {𝑥|𝑥 = −𝑐, for 𝑐 ∈ 𝐶} ▫ 𝐶 ▫ Negative of coordinates (flip across origin) • Translation 𝐶 𝑨 = {𝑑|𝑑 = 𝑐 + 𝑨, for 𝑐 ∈ 𝐶} ▫ ▫ Shift of set

  7. 7 Structuring Elements • The structuring element (SE) can be any shape ▫ This is a mask of “on” pixels within a rectangular container ▫ Typically, the SE is symmetric

  8. 8 Binary Image Logic Operations • Simple operations ▫ Does not require structuring element or raster scan • Extension of basic logic operators ▫ NOT, AND, OR, XOR • Often use for “masking”

  9. 9 Basic Morphology Operations • Erosion • Dilation • Opening • Closing

  10. 10 Dilation • Morphological combination of two sets using vector addition ▫ 𝑌 ⊕ 𝐶 = {𝑞 ∈ 𝐹 2 : 𝑞 = 𝑦 + 𝑐, 𝑦 ∈ 𝑌, 𝑐 ∈ 𝐶} • Output image is “on” anywhere the SE touches an “on” pixel ) 𝑨 ∩ 𝐵 ≠ ∅} ▫ 𝐵 ⊕ 𝐶 = {𝑨|(𝐶  𝐵 – image  𝐶 – SE  𝑨 – displacements (x,y locations)

  11. 11 Dilation Properties • Use of 3 × 3 SE is an isotropic expansion ▫ Called fill or grow operation • Commutative and associative ▫ 𝑌 ⊕ 𝐶 = 𝐶 ⊕ 𝑌 𝑌⨁ 𝐶⨁𝐸 = 𝑌⨁𝐶 ⨁𝐸 • Can be used to fill small holes and gulfs in objects ▫ Increases size of an object • Not an invertible operation

  12. 12 Erosion • Combine two sets using vector subtraction ▫ 𝑌 ⊖ 𝐶 = {𝑞 ∈ 𝐹 2 : 𝑞 = 𝑦 + 𝑐, 𝑐 ∈ 𝐶} • Retain only pixels where the entire SE is overlapped ▫ 𝐵 ⊖ 𝐶 = {𝑨|(𝐶) 𝑨 ⊆ 𝐵}  𝐵 – image  𝐶 – SE  𝑨 – displacements (x,y locations) • Not an invertible operation

  13. 13 Erosion Properties • Use of 3 × 3 SE is an isotropic reduction ▫ Called shrink or reduce operation • Dual operation for dilation • Can be used to get contours ▫ Subtract erosion from original

  14. 14 Opening and Closing • Opening • Closing • Erosion followed by dilation • Dilation followed by erosion (note they are not inverses) ▫ 𝑌 ∙ 𝐶 = 𝑌 ⨁ 𝐶 ⊖ 𝐶 ▫ 𝑌 ∘ 𝐶 = (𝑌 ⊖ 𝐶) ⊕ 𝐶 • Connects objects that are close • Simplified, less detailed • Fills small holes (gulfs) version • Smooths object outline • Removes small objects • Retains “size” • Retains “size” • Idempotent • Idempotent ▫ Repeated application does not change results

  15. 15 Opening • All pixels that fit inside when the SE is “rolled” on the inside of a boundary ▫ 𝐵 ∘ 𝐶 =∪ {(𝐶) 𝑨 |(𝐶) 𝑨 ⊆ 𝐵}

  16. 16 Closing • All pixels that fit inside when the SE is “rolled” on the outside of a boundary

  17. 17 Examples

  18. 18 Examples II

  19. 19 Grayscale Morphology • Can extent binary morphology to grayscale images ▫ Min operation – erosion ▫ Max operation – dilation • The structuring element not only specifies the neighborhood relationship • It specifies the local intensity property • Must consider image as a surface in 2D plane

  20. 20 Top Surface and Umbra • Top surface is the highest intensity in a set ▫ 𝑈 𝐵 𝑦 = max {𝑧, 𝑦, 𝑧 ∈ 𝐵} • Umbra is the “shadow” points below top surface ▫ 𝑉 𝑔 = 𝑦, 𝑧 ∈ 𝐺 × 𝐹, 𝑧 ≤ 𝑔 𝑦

  21. 21 Grayscale Morphology Definitions • Dilation - Top surface of dilation of umbras ▫ 𝑔 ⊕ 𝑙 = 𝑈 𝑉 𝑔 ⊕ 𝑉 𝑙  Left-side is grayscale dilation  Right-side is binary dilation • Erosion ▫ 𝑔 ⊖ 𝑙 = 𝑈 𝑉 𝑔 ⊖ 𝑉 𝑙

  22. 22 Other Morphological Operations • Boundary extraction ▫ 𝛾 𝐵 = 𝐵 − (𝐵 ⊖ 𝐶) ▫ Subtract erosion from original ▫ Notice this is an edge extraction • Convex hull ( 𝐼) ▫ Smallest convex set that contains another set 𝑇 ▫ This is often done for a collection of 2D or 3D points ▫ bwconvhull.m

  23. 23 More on Morphological Operations • Definitions from Szeliski book • Dilation ▫ dilate 𝑔, 𝑡 = 𝜄(𝑑, 1) • Threshold operation ▫ Grows (thickens) 1 locations 𝜄 𝑔, 𝑢 = 1 𝑔 ≥ 𝑢 • Erosion ▫ else 0 ▫ erode 𝑔, 𝑡 = 𝜄(𝑑, 𝑇) • Structuring element ▫ Shrink (thins) 1 locations 𝑡 – e.g. 3 x 3 box filter (1’s indicate ▫ • Opening included pixels in the mask) ▫ open 𝑔, 𝑡 = dilate(erode 𝑔, 𝑡 , 𝑡) 𝑇 – number of “on” pixels in 𝑡 ▫ ▫ Generally smooth the contour of an • Count of 1s in a structuring element object, breaks narrow isthmuses, ▫ 𝑑 = 𝑔 ⊗ 𝑡 and eliminates thin protrusions ▫ Correlation (filter) raster scan • Closing procedure ▫ close 𝑔, 𝑡 = erode(dilate 𝑔, 𝑡 , 𝑡) ▫ Generally smooth the contour of an object, fuses narrow breaks/separations, eliminates small holes, and fills gaps in a contour • Basic morphological operations can be extended to grayscale images

  24. 24 Morphology Example Note: Black is “ 1 ” location • Dilation - grows (thickens) 1 locations • Erosion - shrink (thins) 1 locations • Opening - generally smooth the contour of an object, breaks narrow isthmuses, and eliminates thin protrusions • Closing - generally smooth the contour of an object, fuses narrow breaks/separations, eliminates small holes, and fills gaps in a contour

  25. 25 Connected Components • Semi-global image operation to provide consistent labels to similar regions ▫ Based on adjacency concept • Most efficient algorithms compute in two passes • More computational formulations (iterative) exist from morphology ▫ 𝑌 𝑙 = 𝑌 𝑙−1 ⊕ 𝐶 ∩ 𝐵 Set Connected component Structuring element

  26. 26 More Connected Components • Typically, only the “white” pixels will be considered objects ▫ Dark pixels are background and do not get counted • After labeling connected components, statistics from each region can be computed ▫ Statistics describe the region – e.g. area, centroid, perimeter, etc. • Matlab functions ▫ bwconncomp.m, labelmatrix.m (bwlabel.m) - label image ▫ label2rgb.m – color components for viewing ▫ regionprops.m – calculate region statistics

  27. 27 Connected Component Example Grayscale image Threshold image Opened Image Labeled image – 91 grains of rice

Recommend


More recommend