1 / 72

Computer Vision – Lecture 2

Computer Vision – Lecture 2. Binary Image Analysis 22.10.2009. Bastian Leibe RWTH Aachen http://www.umic.rwth-aachen.de/multimedia leibe@umic.rwth-aachen.de. TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A. Announcements.

lee-hicks
Download Presentation

Computer Vision – Lecture 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Vision – Lecture 2 Binary Image Analysis 22.10.2009 Bastian Leibe RWTH Aachen http://www.umic.rwth-aachen.de/multimedia leibe@umic.rwth-aachen.de TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAA

  2. Announcements • Tuesday lecture slot (13:15 – 14:45) • Currently relatively small room (UMIC 024) • Overlaps with several other lectures. • Possible solution • We can get a bigger room (and reduce overlaps) by shifting the lecture to start 45 minutes earlier. • Quick poll • Who would have conflicting lectures on… • Tue 12:30 – 14:00 ? B. Leibe

  3. Binary Images • Just two pixel values • Foreground and background • Regions of interest B. Leibe Slide credit: Kristen Grauman

  4. Uses: Industrial Inspection R. Nagarajan et al. “A real time marking inspection scheme for semiconductor industries“, 2006 B. Leibe

  5. Uses: Document Analysis, Text Recognition Natural text (after detection) Handwritten digits Source: Till Quack, Martin Renold Scanned documents B. Leibe

  6. Uses: Medical/Bio Data Source: D. Kim et al., Cytometry 35(1), 1999 B. Leibe

  7. Uses: Blob Tracking & Motion Analysis Frame Differencing   Source: Kristen Grauman Background Subtraction   Source: Tobias Jäggli B. Leibe

  8. Uses: Shape Analysis, Free-Viewpoint Video Visual Hull Reconstruction Silhouette Blue-c project, ETH Zurich Medial axis B. Leibe

  9. Uses: Intensity Based Detection • Looking for dark pixels… fg_pix = find(im < 65); B. Leibe Slide Credit: Kristen Grauman

  10. Uses: Color Based Detection • Looking for pixels within a certain color range… fg_pix = find(hue > t1 & hue < t2); B. Leibe Slide Credit: Kristen Grauman

  11. Issues • How to demarcate multiple regions of interest? • Count objects • Compute further features per object • What to do with “noisy” binary outputs? • Holes • Extra small fragments B. Leibe Slide Credit: Kristen Grauman

  12. Outline of Today’s Lecture • Convert the image into binary form • Thresholding • Clean up the thresholded image • Morphological operators • Extract individual objects • Connected Components Labeling • Describe the objects • Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

  13. Thresholding • Grayscale image  Binary mask • Different variants • One-sided • Two-sided • Set membership B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  14. Selecting Thresholds • Typical scenario • Separate an object from a distinct background • Try to separate the different grayvalue distributions • Partition a bimodal histogram • Fit a parametric distribution (e.g. Mixture of Gaussians) • Dynamic or local thresholds • In the following, I will present some simple methods. • We will see some more general methods in Lecture 6… B. Leibe

  15. A Nice Case: Bimodal Intensity Histograms Ideal histogram,light object on dark background Actual observedhistogram with noise B. Leibe Source: Robyn Owens

  16. Not so Nice Cases… • How to separate those? • Threshold selection is difficult in the general case • Domain knowledge often helps • E.g. Fraction of text on a document page ( histogram quantile) • E.g. Size of objects/structure elements Two distinct modes Overlapping modes Multiple modes B. Leibe Source: Shapiro & Stockman

  17. Global Binarization [Otsu’79] • Search for the threshold T that minimizes the within-class variance withinof the two classes separated by T where • This is the same as maximizing the between-class variance between B. Leibe

  18. Algorithm Precompute a cumulative grayvalue histogram h. For each potential threshold T 1.) Separate the pixels into two clusters according to T 2.) Look up n1, n2 in h and compute both cluster means 3.) Compute Choose B. Leibe

  19. Local Binarization [Niblack’86] • Estimate a local threshold within a small neighborhood window W where k [-1,0] is a user-defined parameter. TW W Effect: W B. Leibe

  20. Effects Global threshold selection(Ohta) Original image Local threshold selection(Niblack) B. Leibe

  21. Additional Improvements • Document images often contain a smooth gradient • Try to fit that gradient with a polynomial function Original image Fitted surface Shading compensation Binarized result B. Leibe Source: S. Lu & C. Tan, ICDAR’07

  22. Surface Fitting • Polynomial surface of degree d • Least-squares estimation, e.g. for d=3 (m=10) Solution withpseudo-inverse: Matlab (using SVD): B. Leibe

  23. Surface Fitting • Iterative Algorithm 1.) Fit parametric surface to all points in region. 2.) Subtract estimated surface. 3.) Apply global threshold (e.g. with Ohta method) 4.) Fit surface to all background pixels in original region. 5.) Subtract estimated surface. 5.) Apply global threshold (Ohta) 6.) Iterate further if needed… • The first pass also takes foreground pixels into account. • This is corrected in the following passes. • Basic assumption here: most pixels belong to the background. Initialguess Refinedguess B. Leibe

  24. Result Comparison Original image Global (Ohta) Polynomial + Global Local (Niblack) B. Leibe Source: S. Lu & C. Tan, ICDAR’07

  25. Outline of Today’s Lecture • Convert the image into binary form • Thresholding • Clean up the thresholded image • Morphological operators • Extract individual objects • Connected Components Labeling • Describe the objects • Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

  26. Cleaning the Binarized Results • Results of thresholding often still contain noise • Necessary cleaning operations • Remove isolated points and small structures • Fill holes  Morphological Operators B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

  27. Morphological Operators • Basic idea • Scan the image with a structuring element • Perform set operations (intersection, union)of image content with structuring element • Two basic operations • Dilation (Matlab: imdilate) • Erosion (Matlab: imerode) • Several important combinations • Opening (Matlab: imopen) • Closing (Matlab: imclose) • Boundary extraction Matlab:>> help strel B. Leibe Image Source: R.C. Gonzales & R.E. Woods

  28. Dilation • Definition • “The dilation of AbyBis the setof all displacements z, such thatand Aoverlap by at least one element”. • ( is the mirrored version of B, shifted by z) • Effects • If current pixel z is foreground, set allpixels under (B)z to foreground.  Expand connected components  Grow features  Fill holes B1 A A B1 B2 A B2 B. Leibe Image Source: R.C. Gonzales & R.E. Woods

  29. Erosion • Definition • “The erosion of AbyBis the setof all displacements z, such thatis entirely contained in A”. • Effects • If not every pixel under (B)z is foreground, set the current pixel zto background.  Erode connected components  Shrink features  Remove bridges, branches, noise B1 A 1 2 B2 B. Leibe Image Source: R.C. Gonzales & R.E. Woods

  30. Effects Original image Dilation with circularstructuring element Erosion with circularstructuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  31. Effects Original image Dilation with circularstructuring element Erosion with circularstructuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  32. Opening • Definition • Sequence of Erosion and Dilation • Effect • is defined by the points thatare reached if B is rolled around insideA.  Remove small objects,keep original shape. B. Leibe Image Source: R.C. Gonzales & R.E. Woods

  33. Effect of Opening • Feature selection through sizeof structuring element Opening with smallstructuring element Original image Thresholded Opening with largerstructuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  34. Effect of Opening • Feature selection through shapeof structuring element Input Image Opening with circularstructuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  35. Closing • Definition • Sequence of DilationandErosion • Effect • is defined by the points thatare reached if B is rolled around on the outside of A.  Fill holes,keep original shape. B. Leibe Image Source: R.C. Gonzales & R.E. Woods

  36. Effect of Closing • Fill holes in thresholded image(e.g. due to specularities) Size of structuringelement determineswhich structures areselectively filled. Original image Thresholded Closing with circularstructuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

  37. Example Application: Opening + Closing Original image Opening Closing Erosion Dilation Dilation Erosion Structuringelement Eroded image Dilated image B. Leibe Source: R.C. Gonzales & R.E. Woods

  38. Morphological Boundary Extraction • Definition • First erode A by B, then subtractthe result from the original A. • Effects • If a 33 structuring element is used,this results in a boundary that isexactly 1 pixel thick. B. Leibe Source: R.C. Gonzales & R.E. Woods

  39. Morphology Operators on Grayscale Images • Dilation and erosion are typically performed on binary images. • If image is grayscale: for dilation take the neighborhood max, for erosion take the min. Original Dilated Eroded B. Leibe Slide credit: Kristen Grauman

  40. Outline of Today’s Lecture • Convert the image into binary form • Thresholding • Clean up the thresholded image • Morphological operators • Extract individual objects • Connected Components Labeling • Describe the objects • Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

  41. Connected Components Labeling • Goal: Identify distinct regions Binary image Connected componentslabeling B. Leibe Sources: Shapiro & Stockman, Chandra

  42. Connected Components Examples B. Leibe Source: Pinar Duygulu

  43. Connectedness • Which pixels are considered neighbors? 4-connected 8-connected B. Leibe Source: Chaitanya Chandra

  44. Sequential Connected Components B. Leibe Slide credit: J. Neira

  45. Sequential Connected Components (2) • Process the image from left toright, top to bottom: 1.) If the next pixel to process is 1 i.) If only one of its neighbors (top or left) is 1, copy its label. ii.) If both are 1 and have the same label, copy it. iii.) If they have different labels  Copy the label from the left.  Update the equivalence table. iv.) Otherwise, assign a new label. • Re-label with the smallest of equivalentlabels B. Leibe Slide credit: J. Neira

  46. Application: Blob Tracking Absolute differences from frame to frame B. Leibe Slide credit: K. Grauman

  47. Thresholding B. Leibe Slide credit: K. Grauman

  48. Eroding B. Leibe Slide credit: K. Grauman

  49. Application: Segmentation of a Liver B. Leibe Slide credit: Li Shen

  50. Outline of Today’s Lecture • Convert the image into binary form • Thresholding • Clean up the thresholded image • Morphological operators • Extract individual objects • Connected Components Labeling • Describe the objects • Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

More Related