Statistics: added variance info of the loop closure/localization. GUI: Graph view option to show nodes on which loop closures/localizations happened

This commit is contained in:
matlabbe
2018-07-26 14:40:16 -04:00
parent 60499e895f
commit cfdee23d33
8 changed files with 161 additions and 136 deletions

View File

@@ -822,30 +822,28 @@ void GraphViewer::updateMap(const cv::Mat & map8U, float resolution, float xMin,
}
}
void GraphViewer::updatePosterior(const std::map<int, float> & posterior, float fixedMax)
void GraphViewer::updatePosterior(const std::map<int, float> & posterior, float max)
{
//find max
float max = 0.0f;
for(std::map<int, float>::const_iterator iter = posterior.begin(); iter!=posterior.end(); ++iter)
if(max <= 0.0f)
{
if(iter->first > 0 && iter->second>max)
for(std::map<int, float>::const_iterator iter = posterior.begin(); iter!=posterior.end(); ++iter)
{
max = iter->second;
if(iter->first > 0 && iter->second>max)
{
max = iter->second;
}
}
}
if(max > 0.0f)
{
if(fixedMax > 0.0f && max < fixedMax)
{
max = fixedMax;
}
for(QMap<int, NodeItem*>::iterator iter = _nodeItems.begin(); iter!=_nodeItems.end(); ++iter)
{
std::map<int,float>::const_iterator jter = posterior.find(iter.key());
if(jter != posterior.end())
{
//UDEBUG("id=%d max=%f hyp=%f color = %f", iter.key(), max, jter->second, (1-jter->second/max)*240.0f/360.0f);
iter.value()->setColor(QColor::fromHsvF((1-jter->second/max)*240.0f/360.0f, 1, 1, 1)); //0=red 240=blue
float v = jter->second>max?max:jter->second;
iter.value()->setColor(QColor::fromHsvF((1-v/max)*240.0f/360.0f, 1, 1, 1)); //0=red 240=blue
}
else
{

View File

@@ -1739,6 +1739,10 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
}
_refIds.push_back(stat.refImageId());
_loopClosureIds.push_back(matchId);
if(matchId > 0)
{
_cachedLocalizationsCount[matchId] += 1.0f;
}
//update image views
{
@@ -1956,11 +1960,18 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
{
_ui->graphicsView_graphView->updatePosterior(stat.posterior());
}
else if(_preferencesDialog->isWordsCountGraphView() &&
_preferencesDialog->isRGBDMode() &&
_cachedWordsCount.size())
else if(_preferencesDialog->isRGBDMode())
{
_ui->graphicsView_graphView->updatePosterior(_cachedWordsCount, (float)_preferencesDialog->getKpMaxFeatures());
if(_preferencesDialog->isWordsCountGraphView() &&
_cachedWordsCount.size())
{
_ui->graphicsView_graphView->updatePosterior(_cachedWordsCount, (float)_preferencesDialog->getKpMaxFeatures());
}
else if(_preferencesDialog->isLocalizationsCountGraphView() &&
_cachedLocalizationsCount.size())
{
_ui->graphicsView_graphView->updatePosterior(_cachedLocalizationsCount, 1.0f);
}
}
// update local path on the graph view
_ui->graphicsView_graphView->updateLocalPath(stat.localPath());
@@ -6268,6 +6279,7 @@ void MainWindow::clearTheCache()
_ui->label_stats_loopClosuresRejected->setText("0");
_refIds.clear();
_loopClosureIds.clear();
_cachedLocalizationsCount.clear();
_ui->label_refId->clear();
_ui->label_matchId->clear();
_ui->graphicsView_graphView->clearAll();

View File

@@ -354,6 +354,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->checkBox_odom_onlyInliersShown, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->radioButton_posteriorGraphView, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->radioButton_wordsGraphView, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->radioButton_localizationsGraphView, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->radioButton_nochangeGraphView, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->checkbox_odomDisabled, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->odom_registration, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
@@ -1488,6 +1489,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->checkBox_odom_onlyInliersShown->setChecked(false);
_ui->radioButton_posteriorGraphView->setChecked(true);
_ui->radioButton_wordsGraphView->setChecked(false);
_ui->radioButton_localizationsGraphView->setChecked(false);
_ui->radioButton_nochangeGraphView->setChecked(false);
_ui->checkbox_odomDisabled->setChecked(false);
_ui->checkbox_groundTruthAlign->setChecked(true);
@@ -1906,6 +1908,7 @@ void PreferencesDialog::readGuiSettings(const QString & filePath)
_ui->checkBox_odom_onlyInliersShown->setChecked(settings.value("odomOnlyInliersShown", _ui->checkBox_odom_onlyInliersShown->isChecked()).toBool());
_ui->radioButton_posteriorGraphView->setChecked(settings.value("posteriorGraphView", _ui->radioButton_posteriorGraphView->isChecked()).toBool());
_ui->radioButton_wordsGraphView->setChecked(settings.value("wordsGraphView", _ui->radioButton_wordsGraphView->isChecked()).toBool());
_ui->radioButton_localizationsGraphView->setChecked(settings.value("localizationsGraphView", _ui->radioButton_localizationsGraphView->isChecked()).toBool());
_ui->radioButton_nochangeGraphView->setChecked(settings.value("nochangeGraphView", _ui->radioButton_nochangeGraphView->isChecked()).toBool());
_ui->checkbox_odomDisabled->setChecked(settings.value("odomDisabled", _ui->checkbox_odomDisabled->isChecked()).toBool());
_ui->odom_registration->setCurrentIndex(settings.value("odomRegistration", _ui->odom_registration->currentIndex()).toInt());
@@ -2326,6 +2329,7 @@ void PreferencesDialog::writeGuiSettings(const QString & filePath) const
settings.setValue("odomOnlyInliersShown", _ui->checkBox_odom_onlyInliersShown->isChecked());
settings.setValue("posteriorGraphView", _ui->radioButton_posteriorGraphView->isChecked());
settings.setValue("wordsGraphView", _ui->radioButton_wordsGraphView->isChecked());
settings.setValue("localizationsGraphView", _ui->radioButton_localizationsGraphView->isChecked());
settings.setValue("nochangeGraphView", _ui->radioButton_nochangeGraphView->isChecked());
settings.setValue("odomDisabled", _ui->checkbox_odomDisabled->isChecked());
settings.setValue("odomRegistration", _ui->odom_registration->currentIndex());
@@ -4449,6 +4453,10 @@ bool PreferencesDialog::isWordsCountGraphView() const
{
return _ui->radioButton_wordsGraphView->isChecked();
}
bool PreferencesDialog::isLocalizationsCountGraphView() const
{
return _ui->radioButton_localizationsGraphView->isChecked();
}
bool PreferencesDialog::isOdomDisabled() const
{
return _ui->checkbox_odomDisabled->isChecked();

View File

@@ -94,8 +94,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-1144</y>
<width>681</width>
<y>0</y>
<width>678</width>
<height>2811</height>
</rect>
</property>
@@ -103,16 +103,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@@ -126,7 +117,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>18</number>
<number>0</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -309,6 +300,49 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Save/Load Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="pushButton_loadConfig">
<property name="text">
<string>Load settings (*.ini) ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_saveConfig">
<property name="text">
<string>Save settings (*.ini) ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_resetConfig">
<property name="text">
<string>Reset all settings</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
@@ -384,7 +418,16 @@
</property>
</widget>
</item>
<item row="3" column="1">
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_29">
<property name="title">
<string>Graph View</string>
</property>
<layout class="QGridLayout" name="gridLayout_104" columnstretch="0,1">
<item row="0" column="1">
<widget class="QLabel" name="label_222">
<property name="text">
<string>Show loop closure hypotheses on the graph view. Nodes are colorized from blue to red depending on the highest hypothesis (which is red). Posterior hypotheses should be published. </string>
@@ -397,8 +440,8 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="radioButton_posteriorGraphView">
<item row="1" column="0">
<widget class="QRadioButton" name="radioButton_wordsGraphView">
<property name="text">
<string/>
</property>
@@ -407,7 +450,17 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton_posteriorGraphView">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_478">
<property name="text">
<string>Show 3D visual words count on the graph view. Nodes are colorized from blue to red depending on the maximum visual features extracted (which is red).</string>
@@ -420,24 +473,14 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_wordsGraphView">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="3" column="0">
<widget class="QRadioButton" name="radioButton_nochangeGraphView">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="3" column="1">
<widget class="QLabel" name="label_479">
<property name="text">
<string>No change of graph color.</string>
@@ -450,7 +493,38 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_481">
<property name="text">
<string>Show nodes on which loop closures or localizations happened in red.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_localizationsGraphView">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
<zorder>radioButton_posteriorGraphView</zorder>
<zorder>radioButton_wordsGraphView</zorder>
<zorder>label_478</zorder>
<zorder>label_222</zorder>
<zorder>label_479</zorder>
<zorder>radioButton_nochangeGraphView</zorder>
<zorder>label_481</zorder>
<zorder>radioButton_localizationsGraphView</zorder>
</widget>
</item>
<item>
@@ -509,49 +583,6 @@ Show a yellow background when the number of odometry inliers goes under this thr
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Save/Load Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="pushButton_loadConfig">
<property name="text">
<string>Load settings (*.ini) ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_saveConfig">
<property name="text">
<string>Save settings (*.ini) ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_resetConfig">
<property name="text">
<string>Reset all settings</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
@@ -5053,16 +5084,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<string>Directory of images (optional settings)</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_93">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@@ -15082,16 +15104,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@@ -15171,16 +15184,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@@ -15292,16 +15296,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>