1 / 41

COMP 9517 Computer Vision

COMP 9517 Computer Vision. Binary Image Analysis. Binary Image Analysis. How to do this?. ?. Binary Image Analysis. How to obtain binary images from scale-level images? How to extract connected groups of pixels (components)? How to process the separate components?

evelynmetz
Download Presentation

COMP 9517 Computer Vision

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. COMP 9517 Computer Vision Binary Image Analysis COMP 9517 S2, 2009

  2. Binary Image Analysis • How to do this? ? COMP 9517 S2, 2009

  3. Binary Image Analysis • How to obtain binary images from scale-level images? • How to extract connected groups of pixels (components)? • How to process the separate components? • How to extract properties of components for use in high-level tasks? COMP 9517 S2, 2009

  4. Binary Image • Definition: A binary image is a digital image with all pixel values 0 or 1 • Foreground: a subset of image pixels that are of interest in an image analysis task • Background: the rest of the image • A binary image B can be obtained from a gray-scale image or colour image through a selection operator: • Thresholding: subset of gray tones or colour space • Classification, segmentation, etc COMP 9517 S2, 2009

  5. Binary Image Example • A gray-scale image contains the character “C” • Threshold t=200 to obtain a binary image • 1s denote foreground pixels, 0s background pixels COMP 9517 S2, 2009

  6. Binary Image Analysis • Thresholding: convert gray scale image to binary image • Labelling: connected component labelling • Counting: object counting • Thinning & Thickening: join and/or separate components • Component Properties: extract features for higher level processes COMP 9517 S2, 2009

  7. Applications • Document analysis • Industrial machine vision • Counting, recognition, localisation and inspection tasks COMP 9517 S2, 2009

  8. Thresholding • Binary image can be obtained from gray-scale images by thresholding • Choose foreground and background based on the distribution of gray tones • Types of thresholding: • threshold above: p ≥ the threshold t • threshold below: p < t • threshold inside: t1 ≤ p < t2 • threshold outside: p < t1 or p ≥ t2 COMP 9517 S2, 2009

  9. How to choose the thresholds • The basis for choosing a threshold is the histogram of the gray-tone image • The histogram h of gray-tone image I is defined by Where m spans the gray-level values. COMP 9517 S2, 2009

  10. Compute A Histogram • Compute the histogram H of gray-scale image I Procedure histogram(I,H) { //Initialise the bins of the histogram to zero. for i=0 to MaxVal H[i] = 0; //Compute values by accumulation. for r=0 to MaxRow for c=0 to MaxCol { grayval = I[r,c]; H[grayval] = H[grayval] + 1; } } COMP 9517 S2, 2009

  11. Threshold from Histogram • Bimodal: • one mode corresponding to dark pixels • the other one corresponding to light pixels • choose any value in the valley between two modes • Overlapped modes – more difficult t t COMP 9517 S2, 2009

  12. Pixel and Neighbourhoods • Not only the value of a pixel but also its neighbours are used • 4-neighbours and 8-neighbours • N4[r,c]: {[r-1,c],[r+1,c],[r,c-1], and [r,c+1]} • N8[r,c]: N4[r,c] + {[r-1,c-1], [r-1,c+1], [r+1, c-1], and [r+1,c-1]} • A pixel [r’,c’] neighbours a pixel [r,c] if [r’,c’] lies in the selected type of neighbourhood of [r,c] COMP 9517 S2, 2009

  13. Masks • Mask: a set of pixel positions and corresponding values called weights • Origin of a mask: usually the centre of the mask COMP 9517 S2, 2009

  14. Applying a Mask • Convolution: apply a mask to an image • yields same size output image • for each pixel, place the mask on the image with the mask origin on that pixel • value of pixel under the mask multiplied by the corresponding mask weight • summed up to a single output value for the pixel COMP 9517 S2, 2009

  15. Example of Applying a Mask the sum of the weights COMP 9517 S2, 2009

  16. Example of Applying a Mask COMP 9517 S2, 2009

  17. Connected Component Labelling • Definition: a connected component labelling of a binary image B is a labelled image LB in which the value of each pixel is the label of its connected component. COMP 9517 S2, 2009

  18. Recursive Labelling • B is the original binary image; • LB will be the labelled connected component image. • Recursive_connected_components(B, LB) { • LB = negate(B); • label = 0; • Find_components(LB, label); • } • Find_components(LB,label){ • for (r=0 to MaxRow) • for (c=0 to MaxCol) • if (LB[r, c]==-1){ • label = label + 1; • Search(LB, label, r, c); • } • } • Search(LB, label, r, c) { • LB[r, c] = label; • Nset = neighbours(r, c); • for ([r’, c’] in Nset) • if (LB[r’, c’]==-1) Search(LB, label, r, c); • } COMP 9517 S2, 2009

  19. Recursive Labelling COMP 9517 S2, 2009

  20. Binary Image Morphology • Morphology refers to form, structure and the shape of a region in computer vision • Mathematical morphology: set operations • Structuring element: a shape presented by a binary image, any size and arbitrary structure • Common structuring element: Box, Disk & Ring COMP 9517 S2, 2009

  21. Basic Morphology Operations • Dilation: enlarges a region • Erosion: makes a region smaller • Closing: closes up internal holes and eliminate bays on boundaries • Opening: gets rid of juts COMP 9517 S2, 2009

  22. Dilation • Definition: the dilation of a binary image B by structuring element S is denoted by and is defined by • S is swept over B • When the origin of S touches 1 in B, S is ORed to the output image COMP 9517 S2, 2009

  23. Dilation S B COMP 9517 S2, 2009

  24. Erosion • Definition: the erosion of a binary image B by structuring element S is denoted by B S and is defined by B S • S is swept over B • When every element of S covers a 1-pixel in B, the pixel in B corresponding to the origin of S is ORed to the output image COMP 9517 S2, 2009

  25. Erosion S B COMP 9517 S2, 2009

  26. Closing • Definition: The closing of a binary image B by structuring element S is denote by and is defined by S B COMP 9517 S2, 2009

  27. Opening • Definition: the opening of a binary image B by structuring element S is denoted by and is defined by S B COMP 9517 S2, 2009

  28. Conditional Dilation • Remove noise by erosion, but want to keep entire components • Definition: give an original binary image B, a processed binary image C and a structuring element S, let and . The conditional dilation of C by S with respect to B is defined by where the index m is the smallest index satisfy COMP 9517 S2, 2009

  29. Conditional Dilation • C is repeatedly dilated by S, and each result is reduce to only the pixels that were 1s in B V S B C AND COMP 9517 S2, 2009

  30. Other Morphological Algorithms • Boundary extraction COMP 9517 S2, 2009

  31. Basic Morphological Algorithms • Region Filling COMP 9517 S2, 2009

  32. Applications of Morphology • Opening & closing to separate components and remove holes Thresholding Opening + Closing COMP 9517 S2, 2009

  33. Applications of Morphology • Industrial inspection – identify defects • hole_ring, hole_mask, gear_body, sampling_ring_spacer, sampling_ring_width, tip_spacing , defect_cue a b c d f g h e COMP 9517 S2, 2009

  34. Applications of Morphology • Feature extraction • Extract shape corners Original image B Resultant opening R Corner image C=B-R COMP 9517 S2, 2009

  35. Region Properties • Properties of the regions as input to higher- level procedures for decision making • Area: • Centroid: • Perimeter COMP 9517 S2, 2009

  36. Region Properties • Perimeter length • Circularity • Mean radial distance • Standard deviation of radial distance COMP 9517 S2, 2009

  37. Region Properties • Bounding box and extremal points • Extremal axis length COMP 9517 S2, 2009

  38. Region Properties • Second-order row moment • Second-order column moment • Second-order mixed moment COMP 9517 S2, 2009

  39. Region Adjacency Graphs • Definition: a region adjacency graph(RAG) is a graph in which each node represents a region of the image, and an edge connects two nodes if the two regions are adjacent. 1 -1 0 2 -3 3 -2 COMP 9517 S2, 2009

  40. References • Shaoo, P.K., and others. 1988. A survey of thresholding techniques. Compu. Vision, Graphics, and Image Proc. V.41:233-260. • Rosefeld,A., and J.L. Pfaltz, 1966. Sequential operations in digital picture processing. Journal of the Association for Computing Machinery, Vol. 13: 471-494. • Serra, J. 1982. Image Analysis and Mathematical Morphology. Academic Press, New York. COMP 9517 S2, 2009

  41. Acknowledgement • Some material, including images and tables, were drawn from the textbook and Digital Image Processing by Gonzalesz and Woods. COMP 9517 S2, 2009

More Related