Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

MotionEstimatorRansacL2 no behaving as expected

Dear all,

I would like to estimate the motion between 2 sets of keypoints using the method estimate of MotionEstimatorRansacL2. However it always returns the identity. I've created a toy code to figure it out:

// Create toy keypoints
int nKeypoints = 10;
int dx = 25;
std::vector<cv::KeyPoint> KP0, KP1;
for (int n = 0; n < nKeypoints; n++) {

    cv::KeyPoint kp = cv::KeyPoint((float)n, (float)n, 2);
    KP0.push_back(kp);
    kp.pt.x += dx;
    KP1.push_back(kp);
}

cv::videostab::MotionModel model = cv::videostab::MM_TRANSLATION;
cv::Ptr<cv::videostab::MotionEstimatorRansacL2> MotionEstimator = cv::makePtr<cv::videostab::MotionEstimatorRansacL2>(model);

bool estimationOK;
cv::Mat M = MotionEstimator->estimate(KP1, KP0, &estimationOK);

Any ideas and/or comments would be of great help.

Thanks!!