Made changes in BundleAdjusterBase class to pass a termination criteria to the Levenberg–Marquardt algorithm.

This commit is contained in:
Leonid Beynenson 2011-12-01 13:35:07 +00:00
parent d6ef0378a2
commit 0b907d088d
2 changed files with 8 additions and 1 deletions

View File

@ -93,6 +93,9 @@ public:
double confThresh() const { return conf_thresh_; }
void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
CvTermCriteria termCriteria() { return term_criteria_; }
void setTermCriteria(const CvTermCriteria& term_criteria) { term_criteria_ = term_criteria; }
protected:
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
: num_params_per_cam_(num_params_per_cam),
@ -100,6 +103,7 @@ protected:
{
setRefinementMask(Mat::ones(3, 3, CV_8U));
setConfThresh(1.);
setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
}
// Runs bundle adjustment
@ -127,6 +131,9 @@ protected:
// Threshold to filter out poorly matched image pairs
double conf_thresh_;
//LevenbergMarquardt algorithm termination criteria
CvTermCriteria term_criteria_;
// Camera parameters matrix (CV_64F)
Mat cam_params_;

View File

@ -188,7 +188,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
CvLevMarq solver(num_images_ * num_params_per_cam_,
total_num_matches_ * num_errs_per_measurement_,
cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
term_criteria_);
Mat err, jac;
CvMat matParams = cam_params_;