Preemptive RANSAC for Live
Structure and Motion Estimation
                    by David Nister,
 Machine vision and applications(J) in 2005, 261citations.




                                                2nd/June/2011
                                              presented Inkyu.Sa
Contents
What is RANSAC?
Preemptive RANSAC
Results
My thought
What is RANSAC ?
 Random sample consensus.
 Observation                Estimate model




Source from wikipedia
                                             Outliers
LO-RANSAC
Preemptive RANSAC                Inliers
DEGENSAC
PROSAC
MLESAC, NAPSAC etc.
What is RANSAC ?
           Random sample consensus.
Observation             Estimate model




Source from wikipedia


                                   Outliers
                         Inliers

                                              Source from AFMR, Machine Learning

                                              Reinforcement learning
                                              Use rewards and interaction with the environment to learn
Why do we use RANSAC ?

It is possible estimate robust parameters of model.
There are many noise in out real environments.


 What are disadvantages of RANSAC?
It takes long time to calculate parameters without
boundary condition.
Therefore, threshold and max iteration are required.
How does RANSAC work?
We have this observation data set.
How does RANSAC work?
We have this observation data set.   Randomly choose any two points
                                         and create a hypothesis.
How does RANSAC work?
Randomly choose any two points
    and create a hypothesis.
How does RANSAC work?
Randomly choose any two points               Calculate distances between a
    and create a hypothesis.                hypothesis and all observations.




                                          This hypothesis has a huge distance value.
                                          This process is called “Scoring”.
                                                                 “
                  “ Because wewhich ahas theknowledgeintegration
                    hypothesis
                               have prior
                                             minimum
                                                      that the

                     value of distance could be our model.
How does RANSAC work?
 Calculate distances between a       Again randomly choose two points and
hypothesis and all observations.           create another hypothesis.




                                   This one has a smaller distance value than
                                   previous.
How does RANSAC work?
   Again randomly choose two points and        How many hypothesis can be created?
         create another hypothesis.




This one has a smaller distance value than
previous.                                     Number of lines = 100 C2 = 4,950
                                              Number of lines =999 C2 = 498,501
                                         Total calculation=498,501× 997 = 497,005,497
How does RANSAC work?
Set a threshold to prevent calculation
from all observation.




                                                              ld
                                                            ho
If a hypothesis meet our condition, this




                                                             s
                                                          re
hypothesis is going to be our best model.




                                                        Th
                  In addition set a maxim iterations or maxim time period.
How does RANSAC work?

What happens if we have this observation?
How does RANSAC work?

What happens if we have this observation?




                  Maybe we can’t get a right answer.

      This implies that we need a decent observation data set to get a right
       model unless RANSAC process takes more time and less accurate.
How does RANSAC work?
What happens if we have these observations?




          Inlier noise                          Near degeneracies

       Near degeneracies can be dealt with by sampling non-randomly.
How can we apply RANSAC
        to our applications?
RANSAC can be used refine essential matrix.
Example) A 3D point registration.
                                                             pi    R,T
Assume that we already create a hypothesis                          pi
using any methods such as 5 point, 8points
and svd algorithm and so on.


                   i=N
            e2 =         pi − Rpi − T   2            These two are our model.
                   i=1

pi = Current frame a 3D point in world coordinate.
pi = Previous frame a 3D world point in world coordinate.
Preemptive RANSAC
 Based on breadth-first preemption.
 Using time budget and threshold.




     Source from ICCV2005 tutorial.
Preemptive RANSAC
                         Based on breadth-first preemption.




Source from ICCV2005 tutorial.
Preemptive RANSAC
 Depth-first preemption.




 Source from ICCV2005 tutorial.
Preemptive RANSAC
 Breath-first preemption.




 Source from ICCV2005 tutorial.
Preemptive RANSAC
 Breath-first preemption.




 Source from ICCV2005 tutorial.
Preemptive RANSAC
         log-likelihood, L

Cauchy distribution to model the errors =   −ln(1 + u)
                                                                 2
                                     where ui = pi − Rpi − T
                                     Squared magnitude of a reprojection error


                                                   10
                  robust log-likelihood =   −ln         (1 + ui )
                                                  i=1
                                   N                             where
                                                              ρ = scoring function,
                    L(h) =              ρ(o, h)               o = observation index,
                                                              h = hypothesis index.
                                 o=1

           ρ function return a scalar value representing the log-likelihood given o,h
Preemptive RANSAC

  Algorithm
  1. Randomly permute the observations.
  2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm.




     f (i) = preemption function indicates how many hypotheses
  are to be kept at ith stage.
Preemptive RANSAC

  Algorithm
  1. Randomly permute the observations.
  2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm.
  3. Compute the scores. L1 (h) = ρ(1, h) for h=1,...,f(1). set i=2
Preemptive RANSAC
  Algorithm
  1. Randomly permute the observations.
  2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm.
  3. Compute the scores. L1 (h) = ρ(1, h) for h=1,...,f(1). set i=2
  4. Reorder the hypotheses. The range h=1,...,f(i) contains the best f(i)
  5. If i>N of f(i)=1, quit with the best hypothesis. Otherwise, compute
     Li (h) = ρ(i, h) + Li−1 (h) for h=1,...,f(1). increase i and go to Step 4.
Preemptive RANSAC
      Sequences             Generate all the hypotheses




Scoring and find the best
hypotheses at each stage.
Preemptive RANSAC
Advantages of breath-first RANSAC
 The breath-first RANSAC can spend a lot of time on bad
 observation.



Only compare the previous hypothesis and it takes long time to get the
best one. (Depth-first RANSAC)

Disadvantages of breath-first RANSAC
can spend a lot of time on bad observation.

Author argues that depth-first RANSAC can also waste time on
bad hypothesis.
Preemptive RANSAC
 Disadvantages of breath-first RANSAC
 The breath-first RANSAC can spend a lot of time on bad
 observation.

The depth-first RANSAC can also waste time on bad hypothesis.
Preemptive RANSAC
 Disadvantages of breath-first RANSAC
 The breath-first RANSAC can spend a lot of time on bad
 observation.

The depth-first RANSAC can also waste time on bad hypothesis.

 Typically a hypothesis is consist of multiple observations.
 If this hypothesis contains outliers so that it is meaningless.



 The good observations are much larger than the good hypothesis in
 typical RANSAC settings.
Preemptive RANSAC
Experiments Results(Translation error)
My thoughts

Reasonable using the breath-first searching
It implemented on CVD library.
Issues
Dead depth pixel

About 25% of a kinect point clouds are dead depth pixel, that
has NaN(Not a Number) depth value.

320x240=76800, and valid number of point cloud = 57365

        2D image plane                        3D depth data
VO procedures
1. Obtain features using gpuSurf at t-1 and t
   Output: featureA(t-1), featureB(t)

2. CrossMatching Using L2
   Output: MatchedFeaturesList

3. Find depth for each matched feature (Nr=160~200)
   Output: KeypointA(t-1), KeypointB(t) in 3D world coordinate

4. Compute R,t using ICP (iteration 250, threshold..)

5. Find the current pose of camera by multiply homogeneous
transformation matrix.
                                                                    R i ti
               ξc = o ξt−3 t−3 ξt−2 t−2 ξt−1 t−1 ξt   where ξi =
                                                                   01X3 1

6. Draw x,y,z using
VO procedures
VO procedures
VO procedures
Time consumption Profiling.
1. Total time = 80~100ms

2. gpuSurf = 10 ~ 15ms

3. gpuMatching = 5~7ms

4. ICP 15~20ms

5. Visualization 50~60ms
VO Results
Configuration
VO Results
Ground truth
VO Results
SBC status
1. Ubuntu 10.10 64Bit installed,

2. ROS Diamondback installed
   PCL, Openni_kinect stack

3. CUDA Driver V3.2,
Plans
Cut down 54.28% size of original data.(rgb+point cloud).
(320x240 rgb+point cloud)=2,688,000Bytes => (320x240 rgb+point
cloud)=1,228,800Bytes.

Generate 3D features using surf and a kinect.

Visualization 3D matched features using PCL but has some bugs.

Using ICP on ROS(PointCloudLibrary) to get a transformation matrix.

Visualization camera pose using PCL.

Recording data with MikroKopter and SBC. (10th/June)

Put on the MikroKopter and testing.(13th/June)

Refine pose with RANSAC or EKF.... etc.
Plans
Cut down 54.28% size of original data.(rgb+point cloud).
(320x240 rgb+point cloud)=2,688,000Bytes => (320x240 rgb+point
cloud)=1,228,800Bytes.

Generate 3D features using surf and a kinect.

Visualization 3D matched features using PCL but has some bugs.

Using ICP on ROS(PointCloudLibrary) to get a transformation matrix.

Visualization camera pose using PCL.

Recording data with MikroKopter and SBC. (10th/June)

Put on the MikroKopter and testing.(13th/June)

Refine pose with RANSAC or EKF.... etc.
Thank you.

Preemptive RANSAC by David Nister.

  • 1.
    Preemptive RANSAC forLive Structure and Motion Estimation by David Nister, Machine vision and applications(J) in 2005, 261citations. 2nd/June/2011 presented Inkyu.Sa
  • 2.
    Contents What is RANSAC? PreemptiveRANSAC Results My thought
  • 3.
    What is RANSAC? Random sample consensus. Observation Estimate model Source from wikipedia Outliers LO-RANSAC Preemptive RANSAC Inliers DEGENSAC PROSAC MLESAC, NAPSAC etc.
  • 4.
    What is RANSAC? Random sample consensus. Observation Estimate model Source from wikipedia Outliers Inliers Source from AFMR, Machine Learning Reinforcement learning Use rewards and interaction with the environment to learn
  • 5.
    Why do weuse RANSAC ? It is possible estimate robust parameters of model. There are many noise in out real environments. What are disadvantages of RANSAC? It takes long time to calculate parameters without boundary condition. Therefore, threshold and max iteration are required.
  • 6.
    How does RANSACwork? We have this observation data set.
  • 7.
    How does RANSACwork? We have this observation data set. Randomly choose any two points and create a hypothesis.
  • 8.
    How does RANSACwork? Randomly choose any two points and create a hypothesis.
  • 9.
    How does RANSACwork? Randomly choose any two points Calculate distances between a and create a hypothesis. hypothesis and all observations. This hypothesis has a huge distance value. This process is called “Scoring”. “ “ Because wewhich ahas theknowledgeintegration hypothesis have prior minimum that the value of distance could be our model.
  • 10.
    How does RANSACwork? Calculate distances between a Again randomly choose two points and hypothesis and all observations. create another hypothesis. This one has a smaller distance value than previous.
  • 11.
    How does RANSACwork? Again randomly choose two points and How many hypothesis can be created? create another hypothesis. This one has a smaller distance value than previous. Number of lines = 100 C2 = 4,950 Number of lines =999 C2 = 498,501 Total calculation=498,501× 997 = 497,005,497
  • 12.
    How does RANSACwork? Set a threshold to prevent calculation from all observation. ld ho If a hypothesis meet our condition, this s re hypothesis is going to be our best model. Th In addition set a maxim iterations or maxim time period.
  • 13.
    How does RANSACwork? What happens if we have this observation?
  • 14.
    How does RANSACwork? What happens if we have this observation? Maybe we can’t get a right answer. This implies that we need a decent observation data set to get a right model unless RANSAC process takes more time and less accurate.
  • 15.
    How does RANSACwork? What happens if we have these observations? Inlier noise Near degeneracies Near degeneracies can be dealt with by sampling non-randomly.
  • 16.
    How can weapply RANSAC to our applications? RANSAC can be used refine essential matrix. Example) A 3D point registration. pi R,T Assume that we already create a hypothesis pi using any methods such as 5 point, 8points and svd algorithm and so on. i=N e2 = pi − Rpi − T 2 These two are our model. i=1 pi = Current frame a 3D point in world coordinate. pi = Previous frame a 3D world point in world coordinate.
  • 17.
    Preemptive RANSAC Basedon breadth-first preemption. Using time budget and threshold. Source from ICCV2005 tutorial.
  • 18.
    Preemptive RANSAC Based on breadth-first preemption. Source from ICCV2005 tutorial.
  • 19.
    Preemptive RANSAC Depth-firstpreemption. Source from ICCV2005 tutorial.
  • 20.
    Preemptive RANSAC Breath-firstpreemption. Source from ICCV2005 tutorial.
  • 21.
    Preemptive RANSAC Breath-firstpreemption. Source from ICCV2005 tutorial.
  • 22.
    Preemptive RANSAC log-likelihood, L Cauchy distribution to model the errors = −ln(1 + u) 2 where ui = pi − Rpi − T Squared magnitude of a reprojection error 10 robust log-likelihood = −ln (1 + ui ) i=1 N where ρ = scoring function, L(h) = ρ(o, h) o = observation index, h = hypothesis index. o=1 ρ function return a scalar value representing the log-likelihood given o,h
  • 23.
    Preemptive RANSAC Algorithm 1. Randomly permute the observations. 2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm. f (i) = preemption function indicates how many hypotheses are to be kept at ith stage.
  • 24.
    Preemptive RANSAC Algorithm 1. Randomly permute the observations. 2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm. 3. Compute the scores. L1 (h) = ρ(1, h) for h=1,...,f(1). set i=2
  • 25.
    Preemptive RANSAC Algorithm 1. Randomly permute the observations. 2. Generate all the hypotheses indexed by h= 1,..., f(1) using 5 points algorithm. 3. Compute the scores. L1 (h) = ρ(1, h) for h=1,...,f(1). set i=2 4. Reorder the hypotheses. The range h=1,...,f(i) contains the best f(i) 5. If i>N of f(i)=1, quit with the best hypothesis. Otherwise, compute Li (h) = ρ(i, h) + Li−1 (h) for h=1,...,f(1). increase i and go to Step 4.
  • 26.
    Preemptive RANSAC Sequences Generate all the hypotheses Scoring and find the best hypotheses at each stage.
  • 27.
    Preemptive RANSAC Advantages ofbreath-first RANSAC The breath-first RANSAC can spend a lot of time on bad observation. Only compare the previous hypothesis and it takes long time to get the best one. (Depth-first RANSAC) Disadvantages of breath-first RANSAC can spend a lot of time on bad observation. Author argues that depth-first RANSAC can also waste time on bad hypothesis.
  • 28.
    Preemptive RANSAC Disadvantagesof breath-first RANSAC The breath-first RANSAC can spend a lot of time on bad observation. The depth-first RANSAC can also waste time on bad hypothesis.
  • 29.
    Preemptive RANSAC Disadvantagesof breath-first RANSAC The breath-first RANSAC can spend a lot of time on bad observation. The depth-first RANSAC can also waste time on bad hypothesis. Typically a hypothesis is consist of multiple observations. If this hypothesis contains outliers so that it is meaningless. The good observations are much larger than the good hypothesis in typical RANSAC settings.
  • 30.
  • 31.
    My thoughts Reasonable usingthe breath-first searching It implemented on CVD library.
  • 32.
    Issues Dead depth pixel About25% of a kinect point clouds are dead depth pixel, that has NaN(Not a Number) depth value. 320x240=76800, and valid number of point cloud = 57365 2D image plane 3D depth data
  • 33.
    VO procedures 1. Obtainfeatures using gpuSurf at t-1 and t Output: featureA(t-1), featureB(t) 2. CrossMatching Using L2 Output: MatchedFeaturesList 3. Find depth for each matched feature (Nr=160~200) Output: KeypointA(t-1), KeypointB(t) in 3D world coordinate 4. Compute R,t using ICP (iteration 250, threshold..) 5. Find the current pose of camera by multiply homogeneous transformation matrix. R i ti ξc = o ξt−3 t−3 ξt−2 t−2 ξt−1 t−1 ξt where ξi = 01X3 1 6. Draw x,y,z using
  • 34.
  • 35.
  • 36.
    VO procedures Time consumptionProfiling. 1. Total time = 80~100ms 2. gpuSurf = 10 ~ 15ms 3. gpuMatching = 5~7ms 4. ICP 15~20ms 5. Visualization 50~60ms
  • 37.
  • 38.
  • 39.
  • 40.
    SBC status 1. Ubuntu10.10 64Bit installed, 2. ROS Diamondback installed PCL, Openni_kinect stack 3. CUDA Driver V3.2,
  • 41.
    Plans Cut down 54.28%size of original data.(rgb+point cloud). (320x240 rgb+point cloud)=2,688,000Bytes => (320x240 rgb+point cloud)=1,228,800Bytes. Generate 3D features using surf and a kinect. Visualization 3D matched features using PCL but has some bugs. Using ICP on ROS(PointCloudLibrary) to get a transformation matrix. Visualization camera pose using PCL. Recording data with MikroKopter and SBC. (10th/June) Put on the MikroKopter and testing.(13th/June) Refine pose with RANSAC or EKF.... etc.
  • 42.
    Plans Cut down 54.28%size of original data.(rgb+point cloud). (320x240 rgb+point cloud)=2,688,000Bytes => (320x240 rgb+point cloud)=1,228,800Bytes. Generate 3D features using surf and a kinect. Visualization 3D matched features using PCL but has some bugs. Using ICP on ROS(PointCloudLibrary) to get a transformation matrix. Visualization camera pose using PCL. Recording data with MikroKopter and SBC. (10th/June) Put on the MikroKopter and testing.(13th/June) Refine pose with RANSAC or EKF.... etc.
  • 43.