mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
Added cvsba support for post-processing bundle adjustment (SBA)
This commit is contained in:
@@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "ui_postProcessingDialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <rtabmap/core/Graph.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -38,6 +39,13 @@ PostProcessingDialog::PostProcessingDialog(QWidget * parent) :
|
||||
_ui = new Ui_PostProcessingDialog();
|
||||
_ui->setupUi(this);
|
||||
|
||||
if(!graph::CVSBAOptimizer::available())
|
||||
{
|
||||
_ui->sba->setEnabled(false);
|
||||
}
|
||||
|
||||
restoreDefaults();
|
||||
|
||||
connect(_ui->detectMoreLoopClosures, SIGNAL(clicked(bool)), this, SLOT(updateButtonBox()));
|
||||
connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
|
||||
connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
|
||||
@@ -50,6 +58,11 @@ PostProcessingDialog::PostProcessingDialog(QWidget * parent) :
|
||||
connect(_ui->reextractFeatures, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
|
||||
connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
|
||||
connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
|
||||
|
||||
connect(_ui->sba, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
|
||||
connect(_ui->sba_iterations, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
|
||||
connect(_ui->sba_minInlierDistance, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
|
||||
connect(_ui->sba_minInliers, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
|
||||
}
|
||||
|
||||
PostProcessingDialog::~PostProcessingDialog()
|
||||
@@ -70,6 +83,10 @@ void PostProcessingDialog::saveSettings(QSettings & settings, const QString & gr
|
||||
settings.setValue("reextract_features", this->isReextractFeatures());
|
||||
settings.setValue("refine_neigbors", this->isRefineNeighborLinks());
|
||||
settings.setValue("refine_lc", this->isRefineLoopClosureLinks());
|
||||
settings.setValue("sba", this->isSBA());
|
||||
settings.setValue("sba_iterations", this->sbaIterations());
|
||||
settings.setValue("sba_inlier_distance", this->sbaInlierDistance());
|
||||
settings.setValue("sba_min_inliers", this->sbaMinInliers());
|
||||
if(!group.isEmpty())
|
||||
{
|
||||
settings.endGroup();
|
||||
@@ -89,6 +106,10 @@ void PostProcessingDialog::loadSettings(QSettings & settings, const QString & gr
|
||||
this->setReextractFeatures(settings.value("reextract_features", this->isReextractFeatures()).toBool());
|
||||
this->setRefineNeighborLinks(settings.value("refine_neigbors", this->isRefineNeighborLinks()).toBool());
|
||||
this->setRefineLoopClosureLinks(settings.value("refine_lc", this->isRefineLoopClosureLinks()).toBool());
|
||||
this->setSBA(settings.value("sba", this->isSBA()).toBool());
|
||||
this->setSBAIterations(settings.value("sba_iterations", this->sbaIterations()).toInt());
|
||||
this->setSBAInlierDistance(settings.value("sba_inlier_distance", this->sbaInlierDistance()).toDouble());
|
||||
this->setSBAMinInliers(settings.value("sba_min_inliers", this->sbaMinInliers()).toInt());
|
||||
if(!group.isEmpty())
|
||||
{
|
||||
settings.endGroup();
|
||||
@@ -104,12 +125,16 @@ void PostProcessingDialog::restoreDefaults()
|
||||
setReextractFeatures(false);
|
||||
setRefineNeighborLinks(false);
|
||||
setRefineLoopClosureLinks(false);
|
||||
setSBA(false);
|
||||
setSBAIterations(150);
|
||||
setSBAInlierDistance(0.02);
|
||||
setSBAMinInliers(10);
|
||||
}
|
||||
|
||||
void PostProcessingDialog::updateButtonBox()
|
||||
{
|
||||
_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
|
||||
isDetectMoreLoopClosures() || isRefineNeighborLinks() || isRefineLoopClosureLinks());
|
||||
isDetectMoreLoopClosures() || isRefineNeighborLinks() || isRefineLoopClosureLinks() || isSBA());
|
||||
}
|
||||
|
||||
bool PostProcessingDialog::isDetectMoreLoopClosures() const
|
||||
@@ -147,6 +172,24 @@ bool PostProcessingDialog::isRefineLoopClosureLinks() const
|
||||
return _ui->refineLoopClosureLinks->isChecked();
|
||||
}
|
||||
|
||||
bool PostProcessingDialog::isSBA() const
|
||||
{
|
||||
return _ui->sba->isChecked();
|
||||
}
|
||||
|
||||
int PostProcessingDialog::sbaIterations() const
|
||||
{
|
||||
return _ui->sba_iterations->value();
|
||||
}
|
||||
double PostProcessingDialog::sbaInlierDistance() const
|
||||
{
|
||||
return _ui->sba_minInlierDistance->value();
|
||||
}
|
||||
int PostProcessingDialog::sbaMinInliers() const
|
||||
{
|
||||
return _ui->sba_minInliers->value();
|
||||
}
|
||||
|
||||
//setters
|
||||
void PostProcessingDialog::setDetectMoreLoopClosures(bool on)
|
||||
{
|
||||
@@ -176,5 +219,22 @@ void PostProcessingDialog::setRefineLoopClosureLinks(bool on)
|
||||
{
|
||||
_ui->refineLoopClosureLinks->setChecked(on);
|
||||
}
|
||||
void PostProcessingDialog::setSBA(bool on)
|
||||
{
|
||||
_ui->sba->setChecked(graph::CVSBAOptimizer::available() && on);
|
||||
}
|
||||
void PostProcessingDialog::setSBAIterations(int iterations)
|
||||
{
|
||||
_ui->sba_iterations->setValue(iterations);
|
||||
}
|
||||
void PostProcessingDialog::setSBAInlierDistance(double inlierDistance)
|
||||
{
|
||||
_ui->sba_minInlierDistance->setValue(inlierDistance);
|
||||
}
|
||||
void PostProcessingDialog::setSBAMinInliers(int minInliers)
|
||||
{
|
||||
_ui->sba_minInliers->setValue(minInliers);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user