caracteristicas de imagens ii fitting. etapas p borda borda=cadeia de pixels borda=tem um modelo...
TRANSCRIPT
Caracteristicas de Imagens II
Fitting
Etapas
pBorda Borda=cadeia de pixels
Borda=tem um modelo
Finding Connected Components
Fitting
310 xy
Finding Connected Components (Sequential Algorithm 4-connectivity)
1. Scan the binary image left to right top to bottom
2. If an unlabelled pixel has a value of 1, assign a new label to it according to the following rules:
3. Determine equivalence classes of labels.
4. In the second pass, assign the same label to all elements in an equivalence class.
L0
0
10
0
L
LL
010
LM
L
M
L
1
LLL
0
1
0
(Set L=M)
Rules for 8-connectivity
L0
000
10
000
(Set L=M)
L
LL
0
00
10
00
L
LL
0
00
10
00
L
LL
0
00
10
00
LLL
000
1
0**
LM
L
M
L **
1
**
Least Squares Fit
i
i baxy 2
bm,)( Minimize
0,0
1,0
2,0
3,0
4,0
5,0
6,0
7,0
0 0,2 0,4 0,6 0,8 1
y_medido y_est
Local maximum and local minimum
• Horizontal tangent plane– Parallel to xy-plane
• Relative extrema
Alfer Demir
Condição de máximo ou mínimo
Ajuste de linha por LSF
0)(1
2
n
iii axby
a
0))((21
n
iiii xaxby
b
a
nx
xx
y
yx
ii
ii
ii
ii
iii
2
Solve
0)(1
2
n
iii axby
b
01 1 1
2
n
i
n
i
n
iiiii xaxbyx
0)1)((21
n
iii axby
01 1
n
i
n
iii xabny
Ajuste de linha por LSF
EXCELLINEST(known_y's,known_x's,const,stats)
Line fitting can be max.likelihood - but choice ofmodel is important
i
ii cmxy 2)( Minimize
i
ii cbyax 2 Minimizex
y
x
y
x
y
Distância euclidiana
0 cbyax
1
sin,cos22
ba
ba
cbyaxd iii
di
i
ii cbyax 2E
x
y
Minimização baseada na distância euclidiana
Minimize E, sugeito a:
122 ba
Minimizando com respeito a “c”
0)(01
cbyaxc
Ei
n
ii
n
ii
n
ii byaxcn
11
n
ii
n
ii y
nbx
nac
11
11
ybxac
Substituindo “c” de volta em E
i
ii yybxxa 2)()(E
)()(
...
)()(
nn
11
yyxx
yyxx
U
b
an
nSnnUUn TTT E
22)()(E Uni
ii yybxxa
Novo problema:
nSnTE Minimize
sugeito a: 1 nnT
22
22
ynyyxnyx
yxnyxxnx
iii
iiiT UUS
S é simétrica e positiva definida.
forma quadrática
Mínimo de formas quadráticas de matrizes simétricas positivas definidas
xAx IxAx 0xIA
0
0
y
x
cb
ba
212 ,00det
CBA
cb
ba
0
ii
i
i
cb
ba
,0
0
Autovetores e autovalores de matrizes simétricas positivas definidas
iiT
iiTi i A 0iiii A
111 A
222 A
12112 TT A
21221 TT A212121 TT
0)( 1221 T 012 T
Minimização como um problema de autovalores
x
y
12
21 '' yxyx jip
'
'
0
0''
2
1
y
xyxT
xAx
22
21 )'()'()','( yxyxf
1)'()'( 22 yx
p
x'y'
mínimo
221121 '')(')(')( yxTyTxT p
Minimização baseada na distância euclidiana
0 :be line Let the cbyax
matrix theof VectorsEigen theFind
b
a
n
y
yn
yx
yx
n
yx
yxn
x
x
ii
ii
ii
ii
iii
ii
ii
iii
ii
ii
2
2
2
2
n
yb
n
xac i
ii
i Compute
Maximum Likelihood
2
2
2
i ii cbyaxL
Maximize the Log likelihood function L
Given constraint
122 ba
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
nSnTE Minimize sugeito a: 1 nnTnSnTE Minimize
)1(),L( nnnSnn TT Minimize
0
a
L0
b
L0
L
022L nnS
b
an
nnS ybxac
Maximo e mínimo sugeito a restrições
2249),( yxyxf
0103 yx
yx 310
22)310(49)(~
yyyf
286051)(~
yyyf
01660)(
~
yy
yf
...
Multiplicador de Lagrange
2249),( yxyxf
0103 yx
0),,(
x
yxL
0)103(49),,( 22 yxyxyxL
0),,(
y
yxL
0),,(
yxL
...
Outliers
comportamento desejado
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
Fitting Curves
Fitting Curves – cont.
Distâncias algébrica e euclidiana
cbyaxyxf 22),(
0),( yxf 1),( yxf
x
y
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
cmxy ii
Hough Transform – cont.
cmxy ii )()( ii ymxc
x
y
m
c
Hough Transform – cont.
m
c
m
c
ponto de maior contribuição
Hough Transform – cont.
Hough Transform – cont.
• Hough transform algorithm1. 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
Hough Transform – cont.
sincos ii yx
x
y
22 hw 0
cmxy ii m e c [- +]
Hough Transform – cont.
x
y
Hough Transform – cont.
x
y
Transformada de Hough
Transformada de Hough
Hough Transform – cont.
• Circles– Hough transform can also be used for circles
222 )()( rbyax
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
Mechanics of the Hough transform
• Construct an array representing , d
• For each point, render the curve (, 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
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,… ak and let s1,… sk be 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.
Curve Fitting by Hough Transform
• Suffer with the same problems as line fitting by Hough Transform.
• Computational complexity and storage complexity increase rapidly with number of parameters.
• Not very robust to noise
Deformable Contours
Tracking – cont.
Lip-Reading
Actor-Driven Facial Animation
Human-computer Interaction
Traffic Monitoring
Medical Image Analysis
Medical Image Analysis
SNAKE
• A snake is an active contour defined by
– Was introduced first by Kass, Witkin, and Terzopoulos– An energy is associate with each contour
))(),(()( sysxs
1
0))(())(())(( dssEsEsEE conimageintsnake
SNAKE – cont.
• The internal energy term provides a smoothness constraint on contours
– What kind of contours is preferred
2
2
22)(
)()(
)(
ds
sds
ds
sdsEint
SNAKE – cont.
• The image energy term provides an image related measure
– Should have a large gradient along the contour, i.e., the contour should consist of edge points
|| IIEimage
SNAKE – cont.
• The constraint term can be used to impose additional constraints– For example, some control points are
available and they should be very close to the contour
• Called spring
– Some information may indicate the contours should be as far as possible from some points
• Called volcano
SNAKE – cont.
• Minimization of the energy– This is a standard variational problem
• In order to apply calculus of variations, one needs to use a smooth representation of contours
– Minimization by steepest descent• Requires the functional derivatives of the energy
SNAKE – cont.
Calibração da câmera A câmera é calibrada usando método de Tsai para a
reconstrução de elementos que não estão no plano do modelo.
Erros de sobreposição
Algoritmo estendidoImagem
Filtragem para realce de linhasA1
Extração de segmentos de retas longosA2
Reconhecimento dos segmentosA3
Cálculo da transformação projetiva planar preliminarB1
Reconstrução da visualização do modeloB2
Reajuste das LinhasB3
Cálculo da transformação projetiva planarA4
Calibração da câmeraA5
Reajuste das linhas
tolerância para reajuste das linhas reconstruídas
São usadas faixas de tolerância para descartar pontos distantes.
Reajuste das linhaslinhareconstruída
faixa de tolerância
pontos da imagem
nova linha localizada
A nova linha localizada é obtida pelo método dos mínimos quadrados
Reajuste das linhasResultado do reajuste das linhas:
Depois do reajuste das linhas do modelo na visualização, uma nova transformação é encontrada e uma nova reconstrução pode ser obtida.
Cálculo da transformação projetiva planar
Calibração da câmera A câmera é calibrada usando o método de Tsai, com erro
de sobreposição aceitável.
• Para a primeira imagem, aplicamos o algoritmo proposto por inteiro.
Trabalhando com uma seqüência
• A transformação projetiva planar final da imagem anterior é usada como a transformação preliminar para a imagem corrente.
• Para otimizar o processo, da segunda imagem em diante, tiramos proveito do resultado da imagem anterior.
Próxima imagem da seqüência
A1 Filtragem para realce de linhas
B3 Reajuste das Linhas
A4Cálculo da transformação projetiva planar
A5 Calibração da câmera
Reajuste dos segmentos
Faixa de tolerância sem estimativa
Faixa de tolerância com estimativa
pontos da cena n
novo ajuste
posição do segmento na cena n-2
posição do segmento na cena n-1
estimativa de posição do segmento para cena n
Estimativa de posição do segmento na cena n dada suas posições nas cena n-1 e n-2.
Algoritmo proposto
Filtragem para realce de linhas
Primeira imagem da seqüência
Próxima imagem da seqüência
Extração de segmentos de retas longos
Reconhecimento dos segmentos
Cálculo da transformação projetiva planar preliminar
Reconstrução da visualização do modelo
Cálculo da transformação projetiva planar
Calibração da câmera
Filtragem para realce de linhas
Reajuste dos segmentos
0
1
2
3
4
5
6
7
8
9
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
Limiar
Se
gm
en
tos
ex
tra
ído
sHeurística para determinar o limiar de
corte usado na segmentação Procura um patamar com valor máximo no gráfico que informa
o número de segmentos extraídos para cada valor do limiar de corte.