760 likes | 776 Views
Caracteristicas de Imagens II. Fitting. Etapas. Borda=cadeia de pixels. Borda=tem um modelo. p Borda. Finding Connected Components. Fitting. Finding Connected Components (Sequential Algorithm 4-connectivity). Scan the binary image left to right top to bottom
E N D
Caracteristicas de Imagens II Fitting
Etapas Borda=cadeia de pixels Borda=tem um modelo pBorda Finding Connected Components Fitting
Finding Connected Components (Sequential Algorithm 4-connectivity) • Scan the binary image left to right top to bottom • If an unlabelled pixel has a value of 1, assign a new label to it according to the following rules: • Determine equivalence classes of labels. • In the second pass, assign the same label to all elements in an equivalence class. (Set L=M)
Rules for 8-connectivity (Set L=M)
Local maximum and local minimum • Horizontal tangent plane • Parallel to xy-plane • Relative extrema Alfer Demir
Ajuste de linha por LSF EXCEL LINEST(known_y's,known_x's,const,stats)
y x y Line fitting can be max. likelihood - but choice of model is important x
Distância euclidiana y di x
Minimização baseada na distância euclidiana y Minimize E, sugeito a: x
Novo problema: Minimize forma quadrática sugeito a: S é simétrica e positiva definida.
Mínimo de formas quadráticas de matrizes simétricas positivas definidas
Autovetores e autovalores de matrizes simétricas positivas definidas
x' y' Minimização como um problema de autovalores y p x mínimo
Maximum Likelihood Maximize the Log likelihood function L Given constraint
Fitting as a Probabilistic Inference Problem • Generative model • The measurements are generated by a line with additive Gaussian noise • The likelihood function given by • Maximum likelihood
Multiplicadores de Lagrange sugeito a: Minimize Minimize Minimize
Who came from which line? • Assume we know how many lines there are - but which lines are they? • easy, if we know who came from which line • Strategies • Incremental line fitting • K-means
Hough Transform • There are three problems in model fitting • Given the points that belong to a line, what is the line? • Which points belong to which line? • How many lines are there? • Hough transform is a technique for these problems • The basic idea is to record all the models on which each point lies and then look for models that get many votes
Hough Transform – cont. • Straight line case • Consider a single isolated edge point (xi, yi) • There are an infinite number of lines that could pass through the points • Each of these lines can be characterized by some particular equation
Hough Transform – cont. y c m x
Hough Transform – cont. c c m m ponto de maior contribuição
Hough Transform – cont. • Hough transform algorithm 1. Find all of the desired feature points in the image 2. For each feature point For each possibility i in the accumulator that passes through the feature point Increment that position in the accumulator 3. Find local maxima in the accumulator 4. If desired, map each maximum in the accumulator back to image space
y 0 x Hough Transform – cont. m e c [- +]
Hough Transform – cont. • Circles • Hough transform can also be used for circles
Hough Transform – cont. Here the radius is fixed
Hough Transform – cont. A 3-dimensional parameter space for circles in general
Hough Transform – cont. • More complicated shapes • As you can see, the Hough transform can be used to find shapes with arbitrary complexity as long as we can describe the shape with some fixed number of parameters • The number of parameters required indicates the dimensionality of the accumulator
Generalized Hough Transform • Some shapes may not be easily expressed using a small set of parameters • In this case, we explicitly list all the points on the shape • This variation of Hough transform is known as generalized Hough transform
Construct an array representing q, d For each point, render the curve (q, d) into this array, adding one at each cell Difficulties how big should the cells be? (too big, and we cannot distinguish between quite different lines; too small, and noise causes lines to be missed) How many lines? count the peaks in the Hough array Who belongs to which line? tag the votes Hardly ever satisfactory in practice, because problems with noise and cell size defeat it Mechanics of the Hough transform
Curve Fitting by Hough Transform • Let y=f (x,a) be the chosen parameterization of a target curve. • Discretize the intervals of variation of a1,… akand let s1,… skbe the number of the discretized intervals. • Let A(s1,… sk) be an array of integer counters and initialize all its elements to zero. • For each pixel E(i,j) such that E(i,j)=1, increment all counters on the curve defined by y=f (x,a) in A. • Find all local maxima above certain threshold.