赞
踩
1:Select randomly the minimum number of points required to determine the model parameters.
2:Solve for the parameters of the model.
3:Determine how many points from the set of all points fit with a predefined tolerance
4:If the fraction of the number of inliers over the total number points in the set exceeds a predefined threshold
5:Otherwise, repeat steps 1 through 4 (maximum of N times)
- Given:
- data - a set of observed data points(这里指点云数据)
- model - a model that can be fitted to data points(这里指平面模型)
- n - the minimum number of data values required to fit the model
- (n - 满足模型的最少数据个数)
- k - the maximum number of iterations allowed in the algorithm(最多迭代次数)
- t - a threshold value for determining when a data point fits a model
- (t - 点是否适用于模型的阈值,这里指的是点到平面的距离)
- d - the number of close data values required to assert that a model fits well to data
- ( (d - 判定模型是否适用于数据集的数据数目)
- Return:
- bestfit - model parameters which best fit the data (or nil if no good model is found)
-
- iterations = 0
- bestfit = nil
- besterr = something really large
- while iterations < k {
- maybeinliers = n randomly selected values from data
- maybemodel = model parameters fitted to maybeinliers
- alsoinliers = empty set
- for every point in data not in maybeinliers {
- if point fits maybemodel with an error smaller than t
- add point to alsoinliers
- }
- if the number of elements in alsoinliers is > d {
- % this implies that we may have found a good model
- % now test how good it is
- bettermodel = model parameters fitted to all points in maybeinliers and alsoinliers
- thiserr = a measure of how well model fits these points
- if thiserr < besterr {
- bestfit = bettermodel
- besterr = thiserr
- }
- }
- increment iterations
- }
- return bestfit
Qjizhi/ground_filter_pcl_RANSAC
滤除底面前后对比图(这里使用了kitti的数据作为例子):
由于地面不是倾角为零的平面,可以看到还是有些地面点的,所以设置距离阈值参数的时候需要试试,这里设为0.2比较好(测试下来效果不错),源码设为0.15就不改了.
seg.setDistanceThreshold(0.2);
参考:
M.A. Fischler and R.C. Bolles. Random sample consensus: A paradigm for modelfitting with applications to image analysis and automated cartography.Commu-nications of the ACM, 24(6):381–395, 1981.
RANSAC - formulasearchengine
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。