Made changes in BundleAdjusterBase class to pass a termination criteria to the Levenberg–Marquardt algorithm.
This commit is contained in:
@@ -93,6 +93,9 @@ public:
|
|||||||
double confThresh() const { return conf_thresh_; }
|
double confThresh() const { return conf_thresh_; }
|
||||||
void setConfThresh(double conf_thresh) { conf_thresh_ = 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:
|
protected:
|
||||||
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
|
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
|
||||||
: num_params_per_cam_(num_params_per_cam),
|
: num_params_per_cam_(num_params_per_cam),
|
||||||
@@ -100,6 +103,7 @@ protected:
|
|||||||
{
|
{
|
||||||
setRefinementMask(Mat::ones(3, 3, CV_8U));
|
setRefinementMask(Mat::ones(3, 3, CV_8U));
|
||||||
setConfThresh(1.);
|
setConfThresh(1.);
|
||||||
|
setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs bundle adjustment
|
// Runs bundle adjustment
|
||||||
@@ -127,6 +131,9 @@ protected:
|
|||||||
// Threshold to filter out poorly matched image pairs
|
// Threshold to filter out poorly matched image pairs
|
||||||
double conf_thresh_;
|
double conf_thresh_;
|
||||||
|
|
||||||
|
//Levenberg–Marquardt algorithm termination criteria
|
||||||
|
CvTermCriteria term_criteria_;
|
||||||
|
|
||||||
// Camera parameters matrix (CV_64F)
|
// Camera parameters matrix (CV_64F)
|
||||||
Mat cam_params_;
|
Mat cam_params_;
|
||||||
|
|
||||||
|
@@ -188,7 +188,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
|
|||||||
|
|
||||||
CvLevMarq solver(num_images_ * num_params_per_cam_,
|
CvLevMarq solver(num_images_ * num_params_per_cam_,
|
||||||
total_num_matches_ * num_errs_per_measurement_,
|
total_num_matches_ * num_errs_per_measurement_,
|
||||||
cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
|
term_criteria_);
|
||||||
|
|
||||||
Mat err, jac;
|
Mat err, jac;
|
||||||
CvMat matParams = cam_params_;
|
CvMat matParams = cam_params_;
|
||||||
|
Reference in New Issue
Block a user