LEAS SQUARES. RANSAC. HOUGH RANSFORM. he sldes are from several sources through James Has (Brown); Srnvasa Narasmhan (CMU); Slvo Savarese (U. of Mchgan); Bll Freeman and Antono orralba (MI), ncludng ther own sldes.
Homogeneous coordnates Converson (see also lecture 2) Convertng to homogeneous coordnates homogeneous mage coordnates homogeneous scene coordnates Convertng from homogeneous coordnates to Cartesan coordnates
Homogeneous coordnates are nvarant to scalng. k w k k kw Homogeneous Coordnates k kw k kw w w Cartesan Coordnates Pont n Cartesan coordnates s ra n homogeneous coordnates.
Lnes n a 2D plane 0 c b a -c/b c b a l If = [ 1, 2 ] lne c b a 1 2 1 lne slope -a/b nonhomogeneous (Cartesan) coordnates what ou measure homogeneous... 0 ntercept
he pont s the cross-product of two ntersectng lnes. l l lne l Proof l l l l l l 0 l ) l l ( 0 l ) l l ( l l s the ntersecton pont n homogeneous coordnates also l = X_1 X_2
Ponts at nfnt (deal ponts) 0, 3 3 2 1 c b a l c b a l 0 a b ) c (c l l Intersecton of two parallel lnes s a pont at nfnt. l [b -a 0] = 0 lne slope -a/b lne l 0 2 1 deal pont
Lnes nfnt l Set of deal ponts les on a lne called the lne at nfnt. A lne has a value at the thrd element onl. l 1 0 0 l 2 1 0 0 1 0 0 snce l_nf = X_1nf X_2nf
Fttng Crtcal ssues: nos data; outlers; mssng data etc.
Crtcal ssues: nos data
Crtcal ssues: ntra-class varablt A
Crtcal ssues: outlers
Crtcal ssues: mssng data (occlusons)
Ordnar least squares lne fttng Data: ( 1, 1 ),, ( n, n ) Lne equaton: = m + b Fnd (m,, b) ) to mnmze E Y E = n = 1 ( m b) 1 1 1 = X = M M M n n 1 = Y XB 2 = ( Y XB) 2 ( Y m B = b XB) = Y Y 2( XB) (, ) Y + ( XB) =m+b vertcal resduals onl! ( XB) de db X = 2 X XB 2X Y = XB = X Y 0 Normal equatons: least squares soluton to XB=Y
Ordnar least squares method fttng a lne E n 1 ( m b 2 ) =m+b B 1 X X X Y Lmtatons snce the nose n s neglected. m B b (, ) E. Fals completel for deal vertcal lnes. Sa, =1. he X s sngular and B s not completel defned. Gves a pont (1,).
otal least squares Dstance between pont (, ) and lne a+b=d (a 2 +b 2 =1): a + b d Wll be '-d' nstead of 'd'. E = n = 1 a+b=d Unt normal: 2 ( a( + b, d ) N=(a, b) perpendcular resduals Both and corrupted wth nose.
otal least squares Dstance between pont (, ) and lne a+b=d (a 2 +b 2 =1): a + b d Fnd (a, b, d) to mnmze the sum of squared perpendcular dstances n E = = a + b E = n = 1 ( a + b d 2 ) 2 ( ( d 1, ) a+b=d Unt normal: N=(a, b)
otal least squares Dstance between pont (, ) and lne a+b=d (a 2 +b 2 =1): a + b d Fnd (a, b, d) to mnmze the sum of squared perpendcular dstances n E = = a + b E = n = 1 ( a + b E = n 2( + ) = 0 1 = a b d d d 1 1 n 2 E = ( a( ) b( )) = + 1 = M M de n n = 2 ( U U ) N = 0 dn d 2 ) 2 ( ( d 1, ) a+b=d Unt normal: N=(a, b) a n b n = a b + = + = 1 = 1 n n a b = 2 ( UN) ( UN) Soluton to (U U)N =0, subject to N 2 =1: egenvector of U U assocated wth the smallest egenvalue (least squares soluton to homogeneous lnear sstem UN = 0)
he matr U U s a covarance matr. herefore, the egenvectors of U U are also the sngular vectors of V from the sngular value decomposon, UDV of U(!). Be aware the two U-s are dfferent... ths s when I cannot modf some of the sldes. See lecture 2 too. In the case of a 2D lne, the soluton s v. 2 he parameter d s (the mean of and ) * v he ft goes through the centrod of the data. 2
otal least squares = U M M 1 1 = = = n n n n U U 2 1 1 2 ) )( ( ) ( n n = = 1 2 1 ) ( ) )( ( second moment matr second moment matr
otal least squares = U M M 1 1 = = = n n n n U U 2 1 1 2 ) )( ( ) ( n n = = 1 2 1 ) ( ) )( ( second moment matr N = (a b) second moment matr ( ) N (a, b) ), ( ), (
LS robustness to nler nose... nlers
...but not to outler nose. Bad scale parameter σ (too large!) outler Squared error alwas takes nto account all nlers and outlers. Least square s not robust to outlers.
M. A. Fschler, R. C. Bolles. Random Sample Consensus: A Paradgm for Model Fttng wth Applcatons to Image Analss and Automated Cartograph. Comm. of the ACM, Vol 24, pp 381-395, 1981. RANdom SAmple Consensus Select one match, count nlers Repeat man tmes. Keep match wth largest set of nlers based on a standard devaton gven b the user.
Basc phlosoph: the votng scheme for almost an elemental subset based estmaton. Elemental subset (mnmum number of ponts) randoml pcked up for each hphotess. he standard devaton of the nler nose has to be gven before b the user. Assumpton1: Outler features wll not vote consstentl for an sngle model. Assumpton 2: here are enough features to agree on a good model.
RANSAC Sample set = set of ponts n 2D sgma s gven Algorthm: 1. Select random sample of mnmum requred sze to ft model 2. Compute a putatve model from sample set 3. Compute the set of nlers to ths model from whole data set Repeat 1-3 untl model wth the most nlers over all samples s found
RANSAC for lne fttng eample Inlers and outlers. Sgma has to be gven at the begnnng. Source: R. Raguram
RANSAC for lne fttng eample Least squares ft Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts (= 2). Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon 4. Select ponts consstent wth model (sgma) Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon 4. Select ponts consstent wth model 5. Repeat hpothesze and verf loop Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon 4. Select ponts consstent wth model 5. Repeat hpothesze and verf loop Source: R. Raguram
RANSAC for lne fttng eample 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon 4. Select ponts consstent wth model 5. Repeat hpothesze and verf loop Source: R. Raguram
RANSAC for lne fttng eample he best nler structure largest number of nlers. 1. Randoml select mnmal subset of ponts 2. Hpothesze a model 3. Compute error functon 4. Select ponts consstent wth model 5. Repeat hpothesze and verf loop Source: R. Raguram Do least-square ft on all the nlers.
RANSAC RANdom SAmple Consensus...n general. Algorthm: 1. Select random sample of mnmum requred sze to ft model 2. Compute a putatve model from sample set 3. Compute the set of nlers to ths model from whole data set Repeat 1-3 untl model wth the most nlers over all samples s found
RANSAC Algorthm: 1. Select random sample of mnmum requred sze to ft model 2. Compute a putatve model from sample set 3. Compute the set of nlers to ths model from whole data set Repeat 1-3 untl model wth the most nlers over all samples s found
RANSAC standard devaton of the nler nose has to be gven Algorthm: O = 6 1. Select random sample of mnmum requred sze to ft model 2. Compute a putatve model from sample set 3. Compute the set of nlers to ths model from whole data set Repeat 1-3 untl model wth the most nlers over all samples s found
RANSAC Algorthm: O = 14 1. Select random sample of mnmum requred sze to ft model 2. Compute a putatve model from sample set 3. Compute the set of nlers to ths model from whole data set Repeat 1-3 untl model wth the most nlers over all samples s found
Eample: Image 1 Image 2 Matches: Red: good matches Green: bad matches RANSAC ft a homograph (later lecture) mappng SIF features from mage 1 to 2. Majort of bad matches wll be labeled as outlers.
hs s a robust ft... as we also sad n lecture on SIF.
RANSAC - conclusons a better robust estmator est alread Good Robust to outlers f there are not too man. he number of hphotess N s taken suffcentl large (hundreds to thousands) that RANSAC gves ver smlar results ever tme. Bad Computatonal tme grows quckl wth fracton of outlers and number of parameters. Not good for gettng multple nler structures. Some applcatons Computng a homograph (e.g., mage sttchng) Estmatng fundamental matr (relatng two vews), etc.
Hough transform P.V.C. Hough, Machne Analss of Bubble Chamber Pctures, Proc. Int. Conf. Hgh Energ Accelerators and Instrumentaton, 1959. Gven a set of ponts, fnd the lne or curve that eplans the data ponts best. Appled to lnes, crcles and sometme ellpses.
Hough transform - for lnes Use a polar representaton for the parameter space. Each pont wll add a snusod n the (θ,ρ) parameter space. he (two) dmensons have dfferent thresholds. Mstakes can gve nonestng features. cos 0 2p Hough space sn
In theor... feature votes
...but the effect of nose s ver mportant. feature Peak gets fuzz and hard to locate. votes
Spurous peaks due to unform nose. features votes
A nce eample. In general not so......because mstakes n labelng appear. Lnes: 5-- and 5 http://ostatc.com/fles/mages/ss_hough.jpg
Hough transform - conclusons Good: All ponts are processed ndependentl, so can cope wth occluson/outlers. Some robustness to nose: nose ponts unlkel to contrbute consstentl to an sngle bn. Bad: Spurous peaks due to unform nose. rade-off nose vs. grd sze. Hard to fnd sweet ponts for each threshold when multple features are detected. Is used n the ndustr for repeated processng onl.