我嘗試使用類似於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