binary image analysis
play

Binary Image Analysis Segmentation produces homogenous regions - PowerPoint PPT Presentation

Binary Image Analysis Segmentation produces homogenous regions each region has uniform gray-level each region is a binary image ( 0 : background, 1 : object or the reverse) more intensity values for overlapping regions


  1. Binary Image Analysis • Segmentation produces homogenous regions – each region has uniform gray-level – each region is a binary image ( 0 : background, 1 : object or the reverse) – more intensity values for overlapping regions • Binary images are easier to process and analyze than gray level images E.G.M. Petrakis Binary Image Processing 1

  2. Binary Image Analysis Tasks • Noise suppression • Run-length encoding • Component labeling • Contour extraction • Medial axis computation • Thinning • Filtering (morphological operations) • Feature extraction (size, orientation etc.) E.G.M. Petrakis Binary Image Processing 2

  3. Noise suppression • Small regions are not useful information – apply “size filter” to remove such regions – all regions below T pixels in size are removed by changing the value of their pixels to 0 (background) – it is generally difficult to find a good value of T – if T is small, some noise will remain – if T is large, useful information will be lost E.G.M. Petrakis Binary Image Processing 3

  4. filtered original Image noisy T=10 image filtered original image noisy T=25 image too high! E.G.M. Petrakis Binary Image Processing 4

  5. Run-Length encoding • Compact representation of a binary image • Find the lengths of “ runs ” of 1 pixels sequences E.G.M. Petrakis Binary Image Processing 5

  6. Component Labeling labeled binary connected image components • Assign different labels to pixels belonging to different regions (components) – connected components – not necessary for images with one region E.G.M. Petrakis Binary Image Processing 6

  7. Sequential Algorithm 1. Scan the image from left to right, top to bottom; if the pixel is 1 then a) if only one of the upper or left pixels has a label, copy this label to current pixel b) if both have the same label, copy this label c) if they have different labels, copy one label and mark these two labels as equivalent d) if there are no labeled neighbors, assign it a new label 2. Scan the labeled image and replace all equivalent labels with a common label 3. If there are no neighbors, go to 1 E.G.M. Petrakis Binary Image Processing 7

  8. Contour Extraction boundary binary region • Find all 8-connected pixels of a region that are adjacent to the background – select a starting pixel and track the boundary until it comes back with the starting pixel E.G.M. Petrakis Binary Image Processing 8

  9. Boundary Following • Scan the image from left to right and from top to bottom until an 1 pixel is found 1) stop if this is the initial pixel 2) if it is 1 , add it to the boundary 3) go to a 0 4-neighbor on its left 4) check the 8-neighbors of the current pixel and go to the first 1 pixel found in clockwise order 5) go to step 2 E.G.M. Petrakis Binary Image Processing 9

  10. Area – Center • Binary (or gray) region B[i,j] – B[i,j] = 1 if (i,j) in the region, 0 otherwise N M ∑∑ – Area: = A B [ i , j ] = = i j 1 1 N M N M ∑∑ ∑∑ iB [ i , j ] jB [ i , j ] – Center of gravity: = = = = = i 1 j 1 = i 1 j 1 y x 0 0 A A E.G.M. Petrakis Binary Image Processing 10

  11. Orientation y ρ = x cos θ + y sin θ r ij θ x • Angle with the horizontal direction N M ∑∑ • Find angle θ minimizing = 2 E r B [ i , j ] ij = = i 1 j 1 E.G.M. Petrakis Binary Image Processing 11

  12. Computing Orientation • E = a sin 2 θ – b sin θ cos θ +c cos 2 θ , where N M ∑∑ = 2 a x B [ i , j ] ij = = i 1 j 1 N M ∑∑ = b x y B [ i , j ] ij ij = = i 1 j 1 N M ∑∑ = 2 c y B [ i , j ] ij = = i 1 j 1 E.G.M. Petrakis Binary Image Processing 12

  13. Computation Orientation (cont.) • From which we get = + − − θ − θ E ( a c ) ( a c ) cos 2 b sin 2 1 1 1 2 2 2 • Differentiating with respect to θ and setting the result to zero – tan2 θ = b/(a-c) unless b = 0 and a = c • Consequently − b a c θ = ± θ = ± sin 2 , cos 2 + − + − 2 2 2 2 b ( a c ) b ( a c ) • The solution with the + minimizes E • The solution with the – maximizes E E.G.M. Petrakis Binary Image Processing 13

  14. Computation Orientation (cont.) • Compute E min , E max minimum and maximum of the least second moment E • The ratio e = E max /E min represents roundness – e � 0 for lines – e � 1 for circles E.G.M. Petrakis Binary Image Processing 14

  15. Distance Transform • Compute the distance of each pixel (i,j) from the background S � at iteration n compute F n [i,j]: � F 0 [i,j] = f[i,j] (initial values) � F n [i,j] = F 0 [i,j] + min(F n-1 [u,v]) � (u,v) are the 4-neighbor pixels of (i,j) that is pixels with D([i,j],[u,v]) = 1 � repeat until no distances changes E.G.M. Petrakis Binary Image Processing 15

  16. Example of Distance Transform • Distance transform of an image after the first and second iterations – on the first iteration, all pixels that are not adjacent to S are changed to 2 – on succeeding iterations only pixels further away from S change E.G.M. Petrakis Binary Image Processing 16

  17. Skeleton (Medial Axis) • Set of pixels with locally maximum distance from the background S • Take the distance transform and keep (i,j) Keep a point (i,j) if it is the max in its 4-neighborhood: D([i,j],S) : locally maximum that is D([i,j],S) >= D([u,v],S) where (u,v) are the 4-neighbors of (i,j) • The region can be reconstructed from its skeleton – take all pixels within distance D(i,j) from each pixel (i,j) of the skeleton E.G.M. Petrakis Binary Image Processing 17

  18. Examples of Medial Axis Transform the medial axis transform is very sensitive to noise E.G.M. Petrakis Binary Image Processing 18

  19. Thinning • Binary regions are reduced to their center lines – also called skeletons or core lines – suitable for elongated shapes and OCR – each region (e.g., character) is transformed to a line representation – further analysis and recognition is facilitated • Iteratively check the 8-neighbors of each pixel – delete pixels connected with S unless the 8-neighbor relationship with the remaining pixels is destroyed and except pixels at the end of a line – until no pixels change E.G.M. Petrakis Binary Image Processing 19

  20. no pixels change after 5 iterations E.G.M. Petrakis Binary Image Processing 20

  21. Filtering Operations • Expansion: some background pixels adjacent to the region are changed from 0 to 1 – the region is expanded – fills gaps, the region is smoothed • Shrinking: some pixels are changed from 1 to 0 – the region is shrinked – removes noise, thinning • A combination of Expansion with Shrinking may achieve better smoothing E.G.M. Petrakis Binary Image Processing 21

  22. noisy image expanding followed by shrinking filled holes but did not eliminate noise shrinking followed by expanding eliminated noise but did not fill the holes E.G.M. Petrakis Binary Image Processing 22

  23. Morphological Filtering • Image filtering using 4 filtering operations – two basic: Dilation, Erosion plus – two derived: Opening, Closing – and a Structuring Element ( SE ) whose size and shape may vary SE : rectangle with R=1,2,3 SE : circle with R=1,2,3 E.G.M. Petrakis Binary Image Processing 23

  24. Erosion - Dilation • Erosion : apply the SE on every pixel (i,j) of the image f – (i,j) is the center of the SE – if the whole SE is included in the region then, f[i,j] = 1 – otherwise, f[i,j] = 0 – erosion shrinks the object • Dilation : if at least one pixel of the SE is inside the region f[i,j] = 1 – dilation expands the region E.G.M. Petrakis Binary Image Processing 24

  25. original image Structuring Element ( SE ) Erosion with the SE at various positions of the original image E.G.M. Petrakis Binary Image Processing 25

  26. the erosion of the original image with the SE the bold line shows the border of the original image the dilation of the original image with the SE the bold line shows the border of the original image E.G.M. Petrakis Binary Image Processing 26

  27. Opening - Closing • Opening : erosion followed by dilation with the same SE – filters out “positive” detail, shirks the region • Closing : dilation followed by erosion with the same SE – smoothes by expansion, fills gaps and holes smaller than the SE E.G.M. Petrakis Binary Image Processing 27

  28. opening initial succeeding erosion dilation closing initial succeeding dilation erosion E.G.M. Petrakis Binary Image Processing 28

  29. Pattern Spectrum • Succeeding Openings with the same SE i=-3 i=-4 i=-1 i=-2 i=0 • Succeeding Closings with the same SE i=0 i=1 i=2 i=3 i=4 E.G.M. Petrakis Binary Image Processing 29

  30. Example of Pattern Spectrum -4 -3 -2 -1 0 1 2 3 4 • Size vector p=(a -n ,a -n+1 ,a -n+2 ,….a, a 1 , a 2 , a 3 , …, a n ) opening original closing 1 / 2 ⎛ ⎞ n = ∑ − • Distance between shapes A,B: ⎜ 2 ⎟ D ( A , B ) ( a b ) i i ⎝ ⎠ = − i n E.G.M. Petrakis Binary Image Processing 30

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend