Random Sample Consensus: A Paradigm for Model Fitting with Apphcatlons to Image Analysis and Automated Cartography
在实现人脸姿态估计时,通过opencv自带的DLT(solvepnp)解算出来的值误差很大,而且不稳定。
经过一系列思考和验证,发现实现上并无差错。那么是什么造成了呢?
这是二阶段或多阶段模型的共性错误:通常为分类误差引起的gross error。按照论文所述,分类误差是不服从于正态分布的,所以难以平滑。但可以使用随机采样一致性解决。
随机采样一致性的大致步骤,可以用伪代码表示:
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 k – the maximum number of iterations allowed in the algorithm t – a threshold value for determining when a data point fits a model d – the number of close data values required to assert that a model fits well to data Return: bestfit – model parameters which best fit the data (or nul if no good model is found) iterations = 0 bestfit = nul 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
论文简单讨论了随机采样一致性的k、t值,t值应该取测量平均误差的两到三倍。
而k值,则给出了公式:
z表示的是可信度,b则表示随机选取一次,得到合适模型的概率。
当真实值淹没在噪音中,也可以使用该方法来找出群内点,但是如果b值过低,该方法是无效的。