首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从计算结果中检索离群值?

如何从计算结果中检索离群值?
EN

Stack Overflow用户
提问于 2016-05-22 20:54:26
回答 1查看 2.9K关注 0票数 3

我尝试用类似于Features2D +查找已知对象的单形的方法来比较图像,但是用自写的findAffine()函数代替findHomography()

利用塞莱斯·索尔弗方法得到了考虑离群点的最优仿射矩阵。

代码语言:javascript
复制
    double translation[] = {0, 0};
    double angle = 0;
    double scaleFactor = 1;

    ceres::Problem problem;


    for (size_t i = 0; i < points1.size(); ++i) {
        problem.AddResidualBlock(
                  new ceres::AutoDiffCostFunction<AffineResidual, 1, 2, 1, 1>(
                          new AffineResidual(Eigen::Vector2d(points1[i].x, points1[i].y),
                                             Eigen::Vector2d(points2[i].x, points2[i].y))),
                          new ceres::HuberLoss(1.0),
                          translation,
                          &angle,
                          &scaleFactor);
    }

    ceres::Solver::Options options;
    options.linear_solver_type = ceres::DENSE_QR;
    options.minimizer_progress_to_stdout = true;

    ceres::Solver::Summary summary;
    Solve(options, &problem, &summary);

Ceres解算器提供LossFunction

损失函数减少了高残差残差块的影响,通常是对应于离群点的残差块。

当然,我可以用得到的矩阵从第一幅图像中转换关键点坐标,并与第二次进行比较,得到偏差。但在工作过程中,塞勒斯的解决者已经在里面完成了。

我怎么才能找回它?在文件中没有找到。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-08 14:44:20

我也有过类似的问题。在查看了Ceres库源(特别是ResidualBlock::估价()方法)之后,我得出了一个结论,即对于剩余块,没有明显的“离群点”状态。损失函数似乎只影响块的最终成本值(正如您引用的文档中的短语所描述的那样-“损失函数减少了具有高残差的剩余块的影响”)。所以答案是,你不能从谷神星中检索离群值,没有这样的特征。

解决方法可能是用已解决的结果计算数据的剩余值,并将损失函数应用于它们。来自LossFunction::might ()的评论可能会有所帮助:

代码语言:javascript
复制
// For a residual vector with squared 2-norm 'sq_norm', this method
// is required to fill in the value and derivatives of the loss
// function (rho in this example):
//
//   out[0] = rho(sq_norm),
//   out[1] = rho'(sq_norm),
//   out[2] = rho''(sq_norm),
//
// Here the convention is that the contribution of a term to the
// cost function is given by 1/2 rho(s),  where
//
//   s = ||residuals||^2.
//
// Calling the method with a negative value of 's' is an error and
// the implementations are not required to handle that case.
//
// Most sane choices of rho() satisfy:
//
//   rho(0) = 0,
//   rho'(0) = 1,
//   rho'(s) < 1 in outlier region,
//   rho''(s) < 0 in outlier region,
//
// so that they mimic the least squares cost for small residuals.
virtual void Evaluate(double sq_norm, double out[3]) const = 0;
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37379557

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档