我尝试使用类似于Features2D + Homography to find a known object的方法比较图像,但用自编的findAffine()
函数代替findHomography()
。如何从ceres解算器结果中检索异常值?
我使用Ceres Solver来获得考虑异常值的最佳仿射矩阵。
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:
损失函数减少残余块的影响具有高的残差,通常对应于异常值的那些。
当然,我可以通过获得矩阵转换第一幅图像的关键点坐标,与第二幅图像进行比较并得到偏差。但是Ceres求解器在工作中已经完成了它。
我如何检索它?没有在文档中找到它。
任何人都可以解释为什么问题是downvoted? – victor1234