3D Worlds from Pictures/Videos

Download Report

Transcript 3D Worlds from Pictures/Videos

Random Thoughts 2012
(COMP 066)
Jan-Michael Frahm
Jared Heinly
Last class
• t-distribution (Excel: T.DIST. ) if:
 unknown standard deviation
 if low number of samples
2
Last Class
1. For each pair take the first value minus the second value to
get the paired difference
2. Calculate the mean difference and the standard deviation σ
of all samples
3. Calculate the standard error of the sample
4. z-value
z=
d -m
s
N
s
N
5. Determine the p-value
3
Last Class
• Random number generators (code for random number
generator at
www.cs.unc.edu/~jmf/teaching/fall2012/Random.xlsx
 hardware generators produce truly random numbers but are
slow
 Pseudo random number generator is fast but not truly
random which can be a problem with security applications
• Slot machine simulation (assignment for Monday)
4
What do Statistics Mean?
• How to we know how to interpret a poll of
Obama 50%±3% and Romney 48%±3%?
• How do we interpret an average grows of 10% of the stock
market?
Average
depth
3ft
5
Monte Carlo Simulation
• Simulation allows us to imitate a real world situation to
obtain an understanding of it
• Monte Carlo Simulation is one of the
frequently used simulations
• Monte Carlo simulation was
named for Monte Carlo, Monaco,
where the primary attractions are
casinos containing games of chance.
Games of chance such as roulette wheels, dice, and slot
machines, exhibit random behavior.
• Chance is how the simulation choses its variable values
6
Monte Carlo Simulation: Random Variables
• Random variables are used to model the uncertainties in
the real-world
• Define range and distribution of the variable
 Discrete
 Bernoulli (success and failure)
 Binomial distribution
 Continous
 uniform distribution
 normal distribution
 student distribution
7
Discrete Variables
1. A Bernoulli Random Variable: generate a single random variable
between (0,1)
IF ( RAND( ) <1/2, ‘boy’,’girl’)
Boy
1/2
Baby
1/2
Girl
2. A Binomial Random Variable with n trials:
BINOMINV(RAND(.),n,p)
8
Continuous Distributions
• Uniform distribution
 RAND()
• Normal distribution
 NORMSINV(RAND())
• STUDENT (T) distribution
 TINV(RAND(),degrees of freedom)
9
Simulation
• For simulation evaluate the problem for many different
values of the random variables
• The results of the simulation can then be analyzed to
obtain summary statistics




mean
variance
medium
…
10
Polls
• How can we simulate: “a poll of Obama 50%±3% and
Romney 48%±3%?”
11
Polls
• the mean value of the poll for Obama is 50%
• the standard deviation is?
 with 95% confidence level z*=1.96
 this mean that for the z-distribution 3% are within 1.96
standard deviations.
 hence standard deviation is 1.53%=3%/1.96
• the mean value of the poll for Romney is 48%
• standard deviation is also 1.53%
12
Vote Distributions
• Hence the possible votes are distributed in the following manner
13
Simulate voting
• To simulate the voting we can now draw random samples
from the vote distribution of the candidates
 random number generator with standard normal distribution
 scale the value by the standard deviation
 shift to mean value of the desired distribution (50% Obama,
48% Romney)
14
Stock Market
• How do we interpret an average grows of 10% of the stock
market?
• Again the average grows of 10% only applies for long
periods of time
• Stock market is often described by Brownian motion
 the presumably random moving of particles suspended in a
fluid
 random motion driven by random events
15
Model for Stock Market
• Drift annually is 10%, which is the average increase in
value
• The standard deviation is called volatility and it is 405
annually
• Often expressed in daily values:
 driftdaily= 0.0397% (assuming 252 trading days)
 volatilitydaily= 2.52%
16
Model for Stock Market
• The daily value St behaves in the following way:
St
s2
ln(
) = N ((m )T, s T )
St-1
2
 μ is daily drift
 σ is valatility
 T is time between the t and t-1
• Simplified version
St
ln(
) = a + zts
St-1
17
Simulation
• Simulate by using random variable zt to predict daily stock
price
$200
$150
$100
$50
1
11
21
31
41
51
61
71
81
91
101
111
121
131
141
151
161
171
181
191
201
211
221
231
241
251
$0
18
Using Randomness to Estimate Models
• Estimating models from measurement data
 line fitting
 finding a model to explain the data
• Least squares fitting
 sensitive to outliers
• Using Randomness to find
the correct model
19
Robust data selection: RANSAC
• Estimation of line from point data
{potential line points}
Select m samples
Compute n-parameter solution
Evaluate on {potential line points}
{inliersamples}
Best solution so far?
yes
no
Keep it
good solution probability >0.99
Best solution, {inlier}, {outlier}
no
How many iterations are needed?
• We want to be sure to have a good line with 99%
probability
 depends on ratio ε of good points to bad points
 depends on size s of sample
 depends on number of iterations i
• What is the probability of a good sample?
es
• What is the probability of no good sample in i iterations?
(1-es)i
• So probability of good solution is 1-(1-es)i
21
Camera Motion Estimation
• Where where the cameras upon photo taking?
22
3D from images
Camera 3
Camera 1
Camera 2
Epipolar geometry estimation
• Typically done with RANSAC [RANSAC Fishler & Bolles ‘81]
• Camera motion can be described through 3x3 matrix F
(Step 1) Extract features
(Step 2) Set of potential correspondences
(Step 3) do
(Step 3.1) select minimal sample (i.e. 7 matches)
(Step 3.2) compute solution(s) for F
(Step 3.3) count inliers, if not promising stop
until (#inliers,#samples)<95%
24

(generate hypothesis)
(verify hypothesis)
æ
G = 1- ç1è
#inliers
90%
80%
70%
50%
10%
#samples
5
13
35
382
~30
million
(
# inliers
# matches
)
7 # samples
ö
÷
ø
[Raguram, Frahm, Pollefeys, ECCV’08]
[Raguram, Frahm, Pollefeys, ICCV’09]
Reading Assignment for Monday
• Moldinov Chapter 9
25