Once you have a binary image, you can identify and then analyze each connected set of pixels.The connected components operation takes in a binary image and produces a labeled image in which each pixel has the integer label of either the background (0) or a component.
1. Binary Image Analysis • used in a variety of applications: part inspection riveting fish counting document processing • consists of a set of image analysis operations that are used to produce or process binary images, usually images of 0’s and 1’s. 00010010001000 00011110001000 00010010001000
2.Example: red blood cell image • Many blood cells are separate objects • Many touch – bad! • Salt and pepper noise from thresholding • What operations are needed to clean it up?
3. Useful Operations 1. Thresholding a gray-tone image 2. Determining good thresholds 3. Filtering with mathematical morphology 4. Connected components analysis 5. Numeric feature extraction • location features • gray-tone features • shape features ...
4. Thresholding • Background is black • Healthy cherry is bright • Bruise is medium dark • Histogram shows two cherry regions (black background has been pixel removed) counts 0 256 gray-tone values
5. Automatic Thresholding: Otsu’s Method Grp 1 Grp 2 Assumption: the histogram is bimodal t Method: find the threshold t that minimizes the weighted sum of within-group variances for the two groups that result from separating the gray tones at value t. Works well if the assumption holds.
6.Thresholding Example original image pixels above threshold
7. Mathematical Morphology (Dilation, Erosion, Closing, Opening) • Dilation Dilation expands the connected sets of 1s of a binary image. It can be used for 1. growing features 2. filling holes and gaps
8.• Erosion Erosion shrinks the connected sets of 1s of a binary image. It can be used for 1. shrinking features 2. Removing bridges, branches and small protrusions
9. Structuring Elements A structuring element is a shape mask used in the basic morphological operations. They can be any shape and size that is digitally representable, and each has an origin. box hexagon disk something box(length,width) disk(diameter)
10.Dilation with Structuring Elements The arguments to dilation and erosion are 1. a binary image B 2. a structuring element S dilate(B,S) takes binary image B, places the origin of structuring element S over each 1-pixel, and ORs the structuring element S into the output image at the corresponding position. 0000 dilate 0110 1 0110 0111 11 0000 0000 S B origin BS
11. Erosion with Structuring Elements erode(B,S) takes a binary image B, places the origin of structuring element S over every pixel position, and ORs a binary 1 into that position of the output image only if every position of S (with a 1) covers a 1 in B. origin 0 0 1 1 0 0 0 0 0 0 1 erode 0 0 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 0 B S B S
12. Opening and Closing • Closing is the compound operation of dilation followed by erosion (with the same structuring element) • Opening is the compound operation of erosion followed by dilation (with the same structuring element)
14. Application: Gear Tooth Inspection original binary image detected defects
15. Connected Components Labeling Once you have a binary image, you can identify and then analyze each connected set of pixels. The connected components operation takes in a binary image and produces a labeled image in which each pixel has the integer label of either the background (0) or a component. original thresholded opening+closing components
16. Methods for CC Analysis 1. Recursive Tracking (almost never used) 2. Parallel Growing (needs parallel hardware) 3. Row-by-Row (most common) a. propagate labels down to the bottom, recording equivalences b. Compute equivalence classes c. Replace each labeled pixel with the label of its equivalence class.
17.Labelings shown as Pseudo-Color connected components of 1’s from cleaned, thresholded image connected components of cluster labels