Made changes in BundleAdjusterBase class to pass a termination criteria to the Levenb...
authorLeonid Beynenson <no@email>
Thu, 1 Dec 2011 13:35:07 +0000 (13:35 +0000)
committerLeonid Beynenson <no@email>
Thu, 1 Dec 2011 13:35:07 +0000 (13:35 +0000)
modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp
modules/stitching/src/motion_estimators.cpp

index 81fff1f..b199f66 100644 (file)
@@ -93,6 +93,9 @@ public:
     double confThresh() const { return conf_thresh_; }\r
     void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }\r
 \r
+    CvTermCriteria termCriteria() { return term_criteria_; }\r
+    void setTermCriteria(const CvTermCriteria& term_criteria) { term_criteria_ = term_criteria; }\r
+\r
 protected:\r
     BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement) \r
         : num_params_per_cam_(num_params_per_cam), \r
@@ -100,6 +103,7 @@ protected:
     {    \r
         setRefinementMask(Mat::ones(3, 3, CV_8U));\r
         setConfThresh(1.); \r
+        setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));\r
     }\r
 \r
     // Runs bundle adjustment\r
@@ -127,6 +131,9 @@ protected:
     // Threshold to filter out poorly matched image pairs\r
     double conf_thresh_;\r
 \r
+    //Levenberg–Marquardt algorithm termination criteria\r
+    CvTermCriteria term_criteria_;\r
+\r
     // Camera parameters matrix (CV_64F)\r
     Mat cam_params_;\r
 \r
index c302bba..2abb7dc 100644 (file)
@@ -188,7 +188,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
 \r
     CvLevMarq solver(num_images_ * num_params_per_cam_, \r
                      total_num_matches_ * num_errs_per_measurement_,\r
-                     cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));\r
+                     term_criteria_);\r
 \r
     Mat err, jac;\r
     CvMat matParams = cam_params_;\r