eecs 274 computer vision model fitting. fitting choose a parametric object/some objects to represent...
TRANSCRIPT
![Page 1: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/1.jpg)
EECS 274 Computer Vision
Model Fitting
![Page 2: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/2.jpg)
Fitting
• Choose a parametric object/some objects to represent a set of points
• Three main questions:– what object represents this set of points best?– which of several objects gets which points?– how many objects are there?(you could read line for object here, or circle, or
ellipse or...)
• Reading: FP Chapter 15
![Page 3: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/3.jpg)
Fitting and the Hough transform• Purports to answer all
three questions– in practice, answer isn’t
usually all that much help
• We do for lines only• A line is the set of points
(x, y) such that
• Different choices of , d>0 give different lines
• For any (x, y) there is a one parameter family of lines through this point, given by
• Each point gets to vote for each line in the family; if there is a line that has lots of votes, that should be the line passing through the points
0)(sin)(cos ryx
0)(sin)(cos ryx
![Page 4: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/4.jpg)
tokens votes
•20 points •200 bins in each direction•# of votes is indicated by the pixel brightness •Maximum votes is 20•Note that most points in the vote array are very dark, because they get only one vote.
r
![Page 5: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/5.jpg)
Hough transform
• Construct an array representing , r
• For each point, render the curve (, r) into this array, adding one at each cell
• Difficulties– Quantization error: 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)
– Difficulty with noise
• 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
![Page 6: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/6.jpg)
points votes
r
•Add random noise ([0,0.05]) to each point.•Maximum vote is now 6
![Page 7: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/7.jpg)
points votes
![Page 8: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/8.jpg)
As noise increases, # of max votes decreases difficult to use Hough transform less robustly
![Page 9: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/9.jpg)
•As noise increase, # of max votes in the right bucket goes down, and it is more likely to obtain a large spurious vote in the accumulator•Can be quite difficult to find a line out of noise with Hough transform as the # of votes for the line may be comparable with the # of vote for a spurious line
![Page 10: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/10.jpg)
Choice of model
b
a
x
xx
y
y
baxyi
ii
1
)(
22
2
Least squares but assumes error appears only in y Total least squares
b
a
b
a
yyyyxxy
yxxyxxx
ybxac
b
a
c
b
a
yx
yyxy
xxyx
bacbyaxi
ii
2
2
2
2
222
0
2
2
1
1 s.t. )(
),( vu
0 cbyax
1 if is line to
),( from distancelar perpendicu22 bacbvau
vu
![Page 11: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/11.jpg)
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
• Three strategies– Incremental line fitting– K-means– Probabilistic (later!)
![Page 12: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/12.jpg)
![Page 13: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/13.jpg)
linesl
ix
ji
i j
xldist
lineth to due data
2),(
![Page 14: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/14.jpg)
Fitting curves other than lines• In principle, an easy
generalisation– The probability of
obtaining a point, given a curve, is given by a negative exponential of distance squared
• In practice, rather hard– It is generally difficult to
compute the distance between a point and a curve
![Page 15: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/15.jpg)
Implicit curves
• (u,v) on curve, i.e., ϕ(u,v)=0
• s=(dx,dy)-(u,v) is normal to the curve
0
04 where,0
04 where,0
04 where,0
022
0
22
222
222
222
22222
feydxcybxyaxconic
acbfeydxcybxyaxparabolae
acbfeydxcybxyaxhyperbolae
acbfeydxcybxyaxellipse
rbabyaxyxcircle
cbyaxline
0))(,())(,(),;,(
0
,
udvux
udvuy
ddvu
sT
yxT
yxyx
![Page 16: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/16.jpg)
Robustness
• As we have seen, squared error can be a source of bias in the presence of noise points– One fix is EM - we’ll do this shortly– Another is an M-estimator
• Square nearby, threshold far away
– A third is RANSAC• Search for good points
![Page 17: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/17.jpg)
Missing data
• So far we assume we know which points belong to the line
• In practice, we may have a set of measured points– some of which from a line, – and others of which are noise
• Missing data (or label)
![Page 18: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/18.jpg)
Least squares fits the data well
![Page 19: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/19.jpg)
Single outlier (x-coordinate is corrupted) affects the least-squares result
![Page 20: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/20.jpg)
Single outlier (y-coordinate is corrupted) affects the least-squares result
![Page 21: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/21.jpg)
Bad fit
![Page 22: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/22.jpg)
Heavy tail, light tail
• The red line represents a frequency curve of a long tailed distribution.
• The blue line represents a frequency curve of a short tailed distribution.
• The black line is the standard bell curve..
![Page 23: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/23.jpg)
M-estimators
• Often used in robust statistics
out flattensfunction thehow controls ,),(
residue :),( ,parameters model :
));,((
22
2
u
uu
xr
xr
ii
iii
22
2
),(x
xx
A point that is severalaway from the fitted curve will have no effect on the coefficients
![Page 24: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/24.jpg)
Other M-estimators
• Defined by influence function
• Nonlinear function, solved iteratively• Iterative strategy
– Draw a subset of samples randomly – Fit the subset using least squares– Use the remaining points to see fitness
• Need to pick a sensible σ, which is referred as scale
• Estimate scale at each iteration
0));,((
iii xr
|);(|median 4826.1 )1()()( ni
nii
n xr
![Page 25: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/25.jpg)
Appropriate σ
![Page 26: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/26.jpg)
small σ
![Page 27: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/27.jpg)
large σ
![Page 28: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/28.jpg)
Matching features
What do we do about the “bad” matches?
Szeliski
![Page 29: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/29.jpg)
RAndom SAmple Consensus
Select one match, count inliers
![Page 30: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/30.jpg)
RAndom SAmple Consensus
Select one match, count inliers
![Page 31: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/31.jpg)
Least squares fit
Find “average” translation vector
![Page 32: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/32.jpg)
RANSAC
• Random Sample Consensus
• Choose a small subset uniformly at random
• Fit to that• Anything that is close to
result is signal; all others are noise
• Refit• Do this many times and
choose the best
• Issues– How many times?
• Often enough that we are likely to have a good line
– How big a subset?• Smallest possible
– What does close mean?• Depends on the
problem– What is a good line?
• One where the number of nearby points is so big it is unlikely to be all outliers
![Page 33: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/33.jpg)
![Page 34: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/34.jpg)
Richard Szeliski Image Stitching 34
Descriptor Vector• Orientation = blurred gradient• Similarity Invariant Frame
– Scale-space position (x, y, s) + orientation ()
![Page 35: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/35.jpg)
RANSAC for Homography
![Page 36: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/36.jpg)
RANSAC for Homography
![Page 37: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/37.jpg)
RANSAC for Homography
![Page 38: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/38.jpg)
Probabilistic model for verification
![Page 39: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/39.jpg)
Finding the panoramas
![Page 40: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/40.jpg)
Finding the panoramas
![Page 41: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/41.jpg)
Finding the panoramas
![Page 42: EECS 274 Computer Vision Model Fitting. Fitting Choose a parametric object/some objects to represent a set of points Three main questions: –what object](https://reader036.vdocuments.us/reader036/viewer/2022062309/5697bf721a28abf838c7eb19/html5/thumbnails/42.jpg)
Results