Gui: show graph color based on visual features

This commit is contained in:
matlabbe
2018-07-09 11:33:39 -04:00
parent b783df397a
commit c8100e1464
7 changed files with 118 additions and 61 deletions

View File

@@ -822,7 +822,7 @@ void GraphViewer::updateMap(const cv::Mat & map8U, float resolution, float xMin,
}
}
void GraphViewer::updatePosterior(const std::map<int, float> & posterior)
void GraphViewer::updatePosterior(const std::map<int, float> & posterior, float fixedMax)
{
//find max
float max = 0.0f;
@@ -835,6 +835,10 @@ void GraphViewer::updatePosterior(const std::map<int, float> & posterior)
}
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());

View File

@@ -1587,6 +1587,15 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
{
_cachedSignatures.insert(signature.id(), signature);
_cachedMemoryUsage += signature.sensorData().getMemoryUsed();
unsigned int count = 0;
for(std::multimap<int, cv::Point3f>::const_iterator jter=signature.getWords3().upper_bound(-1); jter!=signature.getWords3().end(); ++jter)
{
if(util3d::isFinite(jter->second))
{
++count;
}
}
_cachedWordsCount.insert(std::make_pair(signature.id(), (float)count));
}
}
}
@@ -1945,6 +1954,12 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
{
_ui->graphicsView_graphView->updatePosterior(stat.posterior());
}
else if(_preferencesDialog->isWordsCountGraphView() &&
_preferencesDialog->isRGBDMode() &&
_cachedWordsCount.size())
{
_ui->graphicsView_graphView->updatePosterior(_cachedWordsCount, (float)_preferencesDialog->getKpMaxFeatures());
}
// update local path on the graph view
_ui->graphicsView_graphView->updateLocalPath(stat.localPath());
if(stat.localPath().size() == 0)
@@ -2004,6 +2019,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
{
_cachedSignatures.clear();
_cachedMemoryUsage = 0;
_cachedWordsCount.clear();
}
_ui->statsToolBox->updateStat("GUI/Cache Data Size/MB", _preferencesDialog->isTimeUsedInFigures()?stat.stamp()-_firstStamp:stat.refImageId(), _cachedMemoryUsage/(1024*1024), _preferencesDialog->isCacheSavedInFigures());
_ui->statsToolBox->updateStat("GUI/Cache Clouds Size/MB", _preferencesDialog->isTimeUsedInFigures()?stat.stamp()-_firstStamp:stat.refImageId(), _createdCloudsMemoryUsage/(1024*1024), _preferencesDialog->isCacheSavedInFigures());
@@ -3766,6 +3782,15 @@ void MainWindow::processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & eve
{
_cachedSignatures.insert(iter->first, iter->second);
_cachedMemoryUsage += iter->second.sensorData().getMemoryUsed();
unsigned int count = 0;
for(std::multimap<int, cv::Point3f>::const_iterator jter=iter->second.getWords3().upper_bound(-1); jter!=iter->second.getWords3().end(); ++jter)
{
if(util3d::isFinite(jter->second))
{
++count;
}
}
_cachedWordsCount.insert(std::make_pair(iter->first, (float)count));
++addedSignatures;
}
_progressDialog->incrementStep();
@@ -3786,6 +3811,15 @@ void MainWindow::processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & eve
QApplication::processEvents();
std::map<int, Transform> poses = event.getPoses();
this->updateMapCloud(poses, event.getConstraints(), mapIds, labels, groundTruth, true);
if( _ui->graphicsView_graphView->isVisible() &&
_preferencesDialog->isWordsCountGraphView() &&
_preferencesDialog->isRGBDMode()&&
_cachedWordsCount.size())
{
_ui->graphicsView_graphView->updatePosterior(_cachedWordsCount, (float)_preferencesDialog->getKpMaxFeatures());
}
_progressDialog->appendText("Updating the 3D map cloud... done.");
}
else
@@ -3800,6 +3834,7 @@ void MainWindow::processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & eve
{
_cachedSignatures.clear();
_cachedMemoryUsage = 0;
_cachedWordsCount.clear();
}
if(_state != kMonitoring && _state != kDetecting)
{
@@ -6189,6 +6224,7 @@ void MainWindow::clearTheCache()
{
_cachedSignatures.clear();
_cachedMemoryUsage = 0;
_cachedWordsCount.clear();
_cachedClouds.clear();
_createdCloudsMemoryUsage = 0;
_cachedEmptyClouds.clear();

View File

@@ -349,7 +349,9 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->checkBox_notifyWhenNewGlobalPathIsReceived, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->spinBox_odomQualityWarnThr, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->checkBox_odom_onlyInliersShown, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
connect(_ui->checkBox_posteriorGraphView, 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_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()));
connect(_ui->checkbox_groundTruthAlign, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
@@ -1452,7 +1454,9 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->checkBox_imageHighestHypShown->setChecked(false);
_ui->spinBox_odomQualityWarnThr->setValue(50);
_ui->checkBox_odom_onlyInliersShown->setChecked(false);
_ui->checkBox_posteriorGraphView->setChecked(true);
_ui->radioButton_posteriorGraphView->setChecked(true);
_ui->radioButton_wordsGraphView->setChecked(false);
_ui->radioButton_nochangeGraphView->setChecked(false);
_ui->checkbox_odomDisabled->setChecked(false);
_ui->checkbox_groundTruthAlign->setChecked(true);
}
@@ -1868,7 +1872,9 @@ void PreferencesDialog::readGuiSettings(const QString & filePath)
_ui->checkBox_notifyWhenNewGlobalPathIsReceived->setChecked(settings.value("notifyNewGlobalPath", _ui->checkBox_notifyWhenNewGlobalPathIsReceived->isChecked()).toBool());
_ui->spinBox_odomQualityWarnThr->setValue(settings.value("odomQualityThr", _ui->spinBox_odomQualityWarnThr->value()).toInt());
_ui->checkBox_odom_onlyInliersShown->setChecked(settings.value("odomOnlyInliersShown", _ui->checkBox_odom_onlyInliersShown->isChecked()).toBool());
_ui->checkBox_posteriorGraphView->setChecked(settings.value("posteriorGraphView", _ui->checkBox_posteriorGraphView->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_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());
_ui->checkbox_groundTruthAlign->setChecked(settings.value("gtAlign", _ui->checkbox_groundTruthAlign->isChecked()).toBool());
@@ -2286,7 +2292,9 @@ void PreferencesDialog::writeGuiSettings(const QString & filePath) const
settings.setValue("notifyNewGlobalPath", _ui->checkBox_notifyWhenNewGlobalPathIsReceived->isChecked());
settings.setValue("odomQualityThr", _ui->spinBox_odomQualityWarnThr->value());
settings.setValue("odomOnlyInliersShown", _ui->checkBox_odom_onlyInliersShown->isChecked());
settings.setValue("posteriorGraphView", _ui->checkBox_posteriorGraphView->isChecked());
settings.setValue("posteriorGraphView", _ui->radioButton_posteriorGraphView->isChecked());
settings.setValue("wordsGraphView", _ui->radioButton_wordsGraphView->isChecked());
settings.setValue("nochangeGraphView", _ui->radioButton_nochangeGraphView->isChecked());
settings.setValue("odomDisabled", _ui->checkbox_odomDisabled->isChecked());
settings.setValue("odomRegistration", _ui->odom_registration->currentIndex());
settings.setValue("gtAlign", _ui->checkbox_groundTruthAlign->isChecked());
@@ -4403,7 +4411,11 @@ bool PreferencesDialog::isOdomOnlyInliersShown() const
}
bool PreferencesDialog::isPosteriorGraphView() const
{
return _ui->checkBox_posteriorGraphView->isChecked();
return _ui->radioButton_posteriorGraphView->isChecked();
}
bool PreferencesDialog::isWordsCountGraphView() const
{
return _ui->radioButton_wordsGraphView->isChecked();
}
bool PreferencesDialog::isOdomDisabled() const
{
@@ -5323,6 +5335,10 @@ bool PreferencesDialog::isRGBDMode() const
{
return _ui->general_checkBox_activateRGBD->isChecked();
}
int PreferencesDialog::getKpMaxFeatures() const
{
return _ui->surf_spinBox_wordsPerImageTarget->value();
}
/*** SETTERS ***/
void PreferencesDialog::setInputRate(double value)

View File

@@ -94,8 +94,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-210</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">
@@ -398,7 +389,30 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_posteriorGraphView">
<widget class="QRadioButton" name="radioButton_posteriorGraphView">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_478">
<property name="text">
<string>Show visual word count on the graph view. Nodes are colorized from blue to red depending on the maximum visual features extracted (which is red). For RGB-D SLAM mode, it is the number of visual words with valid 3D position.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_wordsGraphView">
<property name="text">
<string/>
</property>
@@ -407,6 +421,26 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QRadioButton" name="radioButton_nochangeGraphView">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_479">
<property name="text">
<string>No change of graph color.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -5010,16 +5044,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>
@@ -14290,16 +14315,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>
@@ -14379,16 +14395,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>
@@ -14500,16 +14507,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>