From: Alexey Spizhevoy Date: Tue, 10 Apr 2012 09:07:30 +0000 (+0000) Subject: Fixed bug in videostab sample. Fixed model size in global estimators. X-Git-Tag: accepted/2.0/20130307.220821~364^2~935 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=673f879ccd602e939550a3b7676ef81fd4007769;p=profile%2Fivi%2Fopencv.git Fixed bug in videostab sample. Fixed model size in global estimators. --- diff --git a/modules/videostab/include/opencv2/videostab/global_motion.hpp b/modules/videostab/include/opencv2/videostab/global_motion.hpp index c7dc474..0089d71 100644 --- a/modules/videostab/include/opencv2/videostab/global_motion.hpp +++ b/modules/videostab/include/opencv2/videostab/global_motion.hpp @@ -80,11 +80,11 @@ struct CV_EXPORTS RansacParams RansacParams(int size, float thresh, float eps, float prob) : size(size), thresh(thresh), eps(eps), prob(prob) {} - static RansacParams translation2dMotionStd() { return RansacParams(2, 0.5f, 0.5f, 0.99f); } - static RansacParams translationAndScale2dMotionStd() { return RansacParams(3, 0.5f, 0.5f, 0.99f); } - static RansacParams linearSimilarity2dMotionStd() { return RansacParams(4, 0.5f, 0.5f, 0.99f); } - static RansacParams affine2dMotionStd() { return RansacParams(6, 0.5f, 0.5f, 0.99f); } - static RansacParams homography2dMotionStd() { return RansacParams(8, 0.5f, 0.5f, 0.99f); } + static RansacParams translation2dMotionStd() { return RansacParams(1, 0.5f, 0.5f, 0.99f); } + static RansacParams translationAndScale2dMotionStd() { return RansacParams(2, 0.5f, 0.5f, 0.99f); } + static RansacParams linearSimilarity2dMotionStd() { return RansacParams(2, 0.5f, 0.5f, 0.99f); } + static RansacParams affine2dMotionStd() { return RansacParams(3, 0.5f, 0.5f, 0.99f); } + static RansacParams homography2dMotionStd() { return RansacParams(4, 0.5f, 0.5f, 0.99f); } }; CV_EXPORTS Mat estimateGlobalMotionRobust( diff --git a/modules/videostab/src/global_motion.cpp b/modules/videostab/src/global_motion.cpp index cd1fe6c..eb0a47d 100644 --- a/modules/videostab/src/global_motion.cpp +++ b/modules/videostab/src/global_motion.cpp @@ -377,7 +377,7 @@ Mat PyrLkRobustMotionEstimator::estimate(const Mat &frame0, const Mat &frame1) else { vector mask; - M = findHomography(pointsPrevGood_, pointsGood_, CV_RANSAC, ransacParams_.thresh, mask); + M = findHomography(pointsPrevGood_, pointsGood_, mask, CV_RANSAC, ransacParams_.thresh); ninliers = 0; rmse = 0; diff --git a/samples/cpp/videostab.cpp b/samples/cpp/videostab.cpp index 8a49316..b1e03ca 100644 --- a/samples/cpp/videostab.cpp +++ b/samples/cpp/videostab.cpp @@ -262,8 +262,12 @@ int main(int argc, const char **argv) } if (arg("save-motions") != "no") + { + MotionModel model = stabilizer->motionEstimator()->motionModel(); stabilizer->setMotionEstimator( new ToFileMotionWriter(arg("save-motions"), stabilizer->motionEstimator())); + stabilizer->motionEstimator()->setMotionModel(model); + } stabilizer->setRadius(argi("radius")); if (arg("deblur") == "yes")