Commit 30b461a5 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

Added support of homography motion model into vidostab sample

parent d9d47553
......@@ -65,7 +65,7 @@ void printHelp()
cout << "OpenCV video stabilizer.\n"
"Usage: videostab <file_path> [arguments]\n\n"
"Arguments:\n"
" -m, --model=(transl|transl_and_scale|linear_sim|affine)\n"
" -m, --model=(transl|transl_and_scale|linear_sim|affine|homography)\n"
" Set motion model. The default is affine.\n"
" --outlier-ratio=<float_number>\n"
" Outliers ratio in motion estimation. The default is 0.5.\n"
......@@ -232,8 +232,6 @@ int main(int argc, const char **argv)
if (arg("fps") == "auto") outputFps = source->fps(); else outputFps = argd("fps");
stabilizer->setFrameSource(source);
if (arg("load-motions") == "no")
{
PyrLkRobustMotionEstimator *est = 0;
if (arg("model") == "transl")
est = new PyrLkRobustMotionEstimator(TRANSLATION);
......@@ -243,6 +241,8 @@ int main(int argc, const char **argv)
est = new PyrLkRobustMotionEstimator(LINEAR_SIMILARITY);
else if (arg("model") == "affine")
est = new PyrLkRobustMotionEstimator(AFFINE);
else if (arg("model") == "homography")
est = new PyrLkRobustMotionEstimator(HOMOGRAPHY);
else
{
delete est;
......@@ -253,9 +253,13 @@ int main(int argc, const char **argv)
est->setRansacParams(ransac);
est->setMinInlierRatio(argf("min-inlier-ratio"));
stabilizer->setMotionEstimator(est);
}
else
if (arg("load-motions") != "no")
{
MotionModel model = stabilizer->motionEstimator()->motionModel();
stabilizer->setMotionEstimator(new FromFileMotionReader(arg("load-motions")));
stabilizer->motionEstimator()->setMotionModel(model);
}
if (arg("save-motions") != "no")
stabilizer->setMotionEstimator(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment