mirror of
https://github.com/opencv/opencv.git
synced 2025-08-04 21:36:35 +08:00
Merge pull request #8798 from BKNio:fix_motionEstimation
This commit is contained in:
commit
c397361aa6
@ -402,8 +402,8 @@ Mat estimateGlobalMotionRansac(
|
|||||||
std::vector<Point2f> subset1(params.size);
|
std::vector<Point2f> subset1(params.size);
|
||||||
|
|
||||||
// best hypothesis
|
// best hypothesis
|
||||||
std::vector<Point2f> subset0best(params.size);
|
std::vector<int> bestIndices(params.size);
|
||||||
std::vector<Point2f> subset1best(params.size);
|
|
||||||
Mat_<float> bestM;
|
Mat_<float> bestM;
|
||||||
int ninliersMax = -1;
|
int ninliersMax = -1;
|
||||||
|
|
||||||
@ -447,14 +447,20 @@ Mat estimateGlobalMotionRansac(
|
|||||||
{
|
{
|
||||||
bestM = M;
|
bestM = M;
|
||||||
ninliersMax = numinliers;
|
ninliersMax = numinliers;
|
||||||
subset0best.swap(subset0);
|
bestIndices.swap(indices);
|
||||||
subset1best.swap(subset1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ninliersMax < params.size)
|
if (ninliersMax < params.size)
|
||||||
|
{
|
||||||
// compute RMSE
|
// compute RMSE
|
||||||
bestM = estimateGlobalMotionLeastSquares(subset0best, subset1best, model, rmse);
|
for (int i = 0; i < params.size; ++i)
|
||||||
|
{
|
||||||
|
subset0[i] = points0_[bestIndices[i]];
|
||||||
|
subset1[i] = points1_[bestIndices[i]];
|
||||||
|
}
|
||||||
|
bestM = estimateGlobalMotionLeastSquares(subset0, subset1, model, rmse);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
subset0.resize(ninliersMax);
|
subset0.resize(ninliersMax);
|
||||||
|
Loading…
Reference in New Issue
Block a user