Download presentation
Presentation is loading. Please wait.
Published bySherman Willis Modified over 9 years ago
1
CS 376b Introduction to Computer Vision 02 / 12 / 2008 Instructor: Michael Eckmann
2
Michael Eckmann - Skidmore College - CS 376b - Spring 2008 Today’s Topics Comments/Questions hole counting algorithm from ch. 1 connected components using union-find masks and application of masks binary morphological operators
3
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 hole counting external corners internal corners these are sufficient as long as the holes are “4-connected” and simple (e.g. no donuts)
4
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 hole counting algorithm
5
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 hole counting algorithm
6
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 connected components using union-find A connected components labeling of a binary image B is a labeled image LB in which the value of each pixel is the label of its connected component. The union-find data structure stores a collection of disjoint sets and allows the efficient implementation of union and find. –contains trees where each tree contains one of the disjoint sets –can be stored as an array of parents where index=label and array[index]=parent label union – construct the union of two sets –given the two sets' labels AND the union-find data structure find --- find the “root label” of a set examples on the board of trees and a parent array (fig. 3.9)
7
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 connected components using union-find X: label of first set, Y: label of second set, PARENT: array w/ union-find data structure union (X, Y, PARENT) { j:=X k:=Y while (PARENT[j] != 0) { j:=PARENT[j]; } while (PARENT[k] != 0) { k:=PARENT[k]; } if (j != k) then PARENT[k]:=j; } (from algorithm 3.4 in Shapiro/Stockman “Computer Vision”)
8
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 connected components using union-find X: label of set, PARENT: array w/ union-find data structure find (X, PARENT) { j:=X while (PARENT[j] != 0) { j:=PARENT[j]; } return j; } (from algorithm 3.3 in Shapiro/Stockman “Computer Vision”)
9
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 connected components using union-find Now, the classical connected-components using union-find is: –PASS 1: travel each row from left to right if see a foreground pixel, examine the label of pixel above and to left –if only one is labeled, then make current pixel that same label –if neither above or left pixel has labels (i.e. they are background pixels), then pick a new label for current pixel –if they are both labeled, then label the current pixel the lesser of the two labels –if above and left pixel have different labels, enter the equivalence class into the union-find data structure (perform a union of the two sets) all foreground pixels have been labeled and we have a set of equivalence classes for all labels
10
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 connected components using union-find classical connected-components using union-find (cont.) –PASS 2: relabel the labels of the pixels with the root label of the equivalence class in the union-find data structure (using the find algorithm to determine this root label) see Algorithm 3.6 on page 65 in Shapiro and Stockman Let's do an example on the board.
11
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 masks a mask is a set of pixel positions whose values are weights a mask has an origin, which is usually in the center of symmetrical masks (example of symmetrical vs. non-symmetrical masks on board) masks are applied to images to alter their pixel values based on the pixels in their neighborhoods –compute a new value by multiplying the corresponding weights in the mask with the values of the image pixels and sum up (and usually divide by sum of weights) –replace pixel value with this new value for pixels near top/bottom/left/right of image, usually add phantom rows or columns of identical pixels when applying a mask to these pixels look at an example on the board
12
Michael Eckmann - Skidmore College - CS 376 - Spring 2008 binary morphology a structuring element is a typically small binary image representing some shape binary image morphological operations –dilation – increase the size of regions –erosion – decrease the size of regions –closing – closes up holes within regions –is a dilation followed by an erosion –opening – get rid of jutting out portions of regions –is an erosion followed by a dilation let's look at examples in figure 3.13
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.