Added constraints editing to DatabaseViewer to add/reject loop closures, refine loop closures with ICP, detect more loop closures using the optimized map

Added Feature2D::parseParameters()
 

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1632 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-08-11 15:23:06 +00:00
parent 52af62394e
commit df76e3cd29
13 changed files with 1961 additions and 378 deletions

View File

@@ -44,7 +44,6 @@ namespace rtabmap
{
class Memory;
class ImageView;
}
class RTABMAPGUI_EXP DatabaseViewer : public QMainWindow
{
@@ -55,6 +54,9 @@ public:
virtual ~DatabaseViewer();
bool openDatabase(const QString & path);
protected:
virtual void resizeEvent(QResizeEvent* anEvent);
private slots:
void openDatabase();
void generateGraph();
@@ -64,6 +66,9 @@ private slots:
void generateTOROGraph();
void view3DMap();
void generate3DMap();
void detectMoreLoopClosures();
void refineAllNeighborLinks();
void refineAllLoopClosureLinks();
void sliderAValueChanged(int);
void sliderBValueChanged(int);
void sliderAMoved(int);
@@ -72,6 +77,10 @@ private slots:
void sliderLoopValueChanged(int);
void sliderIterationsValueChanged(int);
void updateGraphView();
void refineConstraint();
void addConstraint();
void resetConstraint();
void rejectConstraint();
private:
void updateIds();
@@ -81,7 +90,29 @@ private:
QLabel * labelChildren,
rtabmap::ImageView * view,
QLabel * labelId);
void updateWordsMatching();
void updateConstraintView(const rtabmap::Link & link);
void updateConstraintButtons();
std::multimap<int, Link>::iterator findLink(
std::multimap<int, Link> & links,
int from,
int to);
Link findActiveLink(int from, int to);
bool containsLink(
std::multimap<int, Link> & links,
int from,
int to);
std::multimap<int, rtabmap::Link> updateLinksWithModifications(
const std::multimap<int, rtabmap::Link> & edgeConstraints);
void updateLoopClosuresSlider(int from = 0, int to = 0);
void refineConstraint(int from, int to);
bool addConstraint(int from, int to, bool silent);
std::map<int, int> generateGraph(int fromNode, int margin);
std::map<int, Transform> optimizeGraph(
const std::map<int, int> & ids,
const std::map<int, Transform> & poses,
const std::multimap<int, Link> & links,
std::list<std::map<int, rtabmap::Transform> > * graphes = 0);
private:
Ui_DatabaseViewer * ui_;
@@ -94,7 +125,12 @@ private:
std::list<std::map<int, rtabmap::Transform> > graphes_;
std::map<int, rtabmap::Transform> poses_;
std::multimap<int, rtabmap::Link> links_;
std::multimap<int, rtabmap::Link> linksRefined_;
std::multimap<int, rtabmap::Link> linksAdded_;
std::multimap<int, rtabmap::Link> linksRemoved_;
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > scans_;
};
}
#endif /* DATABASEVIEWER_H_ */

View File

@@ -24,6 +24,7 @@
#include <QtGui/QGraphicsView>
#include <QtCore/QRectF>
#include <QtCore/QMultiMap>
#include <opencv2/features2d/features2d.hpp>
#include <map>
@@ -57,7 +58,12 @@ public:
void setFeatures(const std::multimap<int, cv::KeyPoint> & refWords);
void setImage(const QImage & image);
void setImageDepth(const QImage & image);
void setFeatureColor(int id, const QColor & color);
void setFeaturesColor(const QColor & color);
const QMultiMap<int, rtabmap::KeypointItem *> & getFeatures() const {return _features;}
void clearLines();
void clear();
protected:
@@ -82,7 +88,7 @@ private:
QAction * _showLines;
QAction * _saveImage;
QList<rtabmap::KeypointItem *> _features;
QMultiMap<int, rtabmap::KeypointItem *> _features;
QGraphicsPixmapItem * _image;
QGraphicsPixmapItem * _imageDepth;
};

File diff suppressed because it is too large Load Diff

View File

@@ -87,9 +87,9 @@ bool ImageView::isFeaturesShown()
void ImageView::setFeaturesShown(bool shown)
{
_showFeatures->setChecked(shown);
for(int i=0; i<_features.size(); ++i)
for(QMultiMap<int, KeypointItem*>::iterator iter=_features.begin(); iter!=_features.end(); ++iter)
{
_features[i]->setVisible(_showFeatures->isChecked());
iter.value()->setVisible(_showFeatures->isChecked());
}
}
@@ -236,11 +236,7 @@ void ImageView::wheelEvent(QWheelEvent * e)
void ImageView::setFeatures(const std::multimap<int, cv::KeyPoint> & refWords)
{
for(int i=0; i<_features.size(); ++i)
{
scene()->removeItem(_features[i]);
delete _features[i];
}
qDeleteAll(_features);
_features.clear();
rtabmap::KeypointItem * item = 0;
@@ -261,7 +257,7 @@ void ImageView::setFeatures(const std::multimap<int, cv::KeyPoint> & refWords)
item = new rtabmap::KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, QColor(255, 255, 0, alpha));
scene()->addItem(item);
_features.append(item);
_features.insert(id, item);
item->setVisible(_showFeatures->isChecked());
item->setZValue(1);
}
@@ -297,13 +293,51 @@ void ImageView::setImageDepth(const QImage & imageDepth)
}
}
void ImageView::setFeatureColor(int id, const QColor & color)
{
QList<KeypointItem*> items = _features.values(id);
if(items.size())
{
for(int i=0; i<items.size(); ++i)
{
items[i]->setPen(QPen(color));
items[i]->setBrush(QBrush(color));
}
}
else
{
UWARN("Not found feature %d", id);
}
}
void ImageView::setFeaturesColor(const QColor & color)
{
for(QMultiMap<int, KeypointItem*>::iterator iter=_features.begin(); iter!=_features.end(); ++iter)
{
iter.value()->setPen(QPen(color));
iter.value()->setBrush(QBrush(color));
}
}
void ImageView::clearLines()
{
if(this->scene())
{
QList<QGraphicsItem*> items = this->scene()->items();
for(int i=0; i<items.size(); ++i)
{
QGraphicsLineItem * line = qgraphicsitem_cast<QGraphicsLineItem*>(items[i]);
if(line)
{
delete line;
}
}
}
}
void ImageView::clear()
{
for(int i=0; i<_features.size(); ++i)
{
scene()->removeItem(_features[i]);
delete _features[i];
}
qDeleteAll(_features);
_features.clear();
if(_image)

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1076</width>
<height>637</height>
<height>582</height>
</rect>
</property>
<property name="windowTitle">
@@ -260,7 +260,7 @@
<x>0</x>
<y>0</y>
<width>1076</width>
<height>22</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -282,6 +282,10 @@
<addaction name="actionGenerate_local_graph_dot"/>
<addaction name="actionGenerate_TORO_graph_graph"/>
<addaction name="separator"/>
<addaction name="actionDetect_more_loop_closures"/>
<addaction name="actionRefine_all_neighbor_links"/>
<addaction name="actionRefine_all_loop_closure_links"/>
<addaction name="separator"/>
<addaction name="actionClean_database"/>
<addaction name="actionClean_local_graph"/>
<addaction name="separator"/>
@@ -309,13 +313,6 @@
<item>
<widget class="rtabmap::CloudViewer" name="constraintsViewer" native="true"/>
</item>
<item>
<widget class="QLabel" name="label_constraint">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
@@ -355,6 +352,79 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_constraint">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Transform</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Fitness</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_fitness">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButton_refine">
<property name="text">
<string>Refine (ICP)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_reset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_add">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_reject">
<property name="text">
<string>Reject</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
</item>
</layout>
@@ -464,6 +534,371 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_icp">
<property name="windowTitle">
<string>ICP parameters</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_3">
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QGridLayout" name="gridLayout_4" columnminimumwidth="1,0">
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Decimation</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_icp_decimation">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Max depth</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_icp_maxDepth">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Voxel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_icp_voxel">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.005000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Max correspondence distance</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_icp_maxCorrespDistance">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Iteration</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinBox_icp_iteration">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Point to plane</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="checkBox_icp_p2plane">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Normal K neighbors</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="spinBox_icp_normalKSearch">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_visual">
<property name="windowTitle">
<string>Visual parameters</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_4">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QGridLayout" name="gridLayout_3" columnminimumwidth="1,0">
<item row="0" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Recompute features (SURF)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_visual_recomputeFeatures">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>SURF hessian threshold</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_visual_hessian">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>10.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
<property name="value">
<double>150.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>NNDR</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_visual_nndr">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.800000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Min correspondences</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBox_visual_minCorrespondences">
<property name="minimum">
<number>3</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Max correspondence distance</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_visual_maxCorrespDistance">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Iteration</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="spinBox_visual_iteration">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Max feature depth</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_visual_maxDepth">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<action name="actionOpen_database">
<property name="text">
<string>Open database</string>
@@ -529,6 +964,21 @@
<string>Generate TORO graph (*.graph)...</string>
</property>
</action>
<action name="actionRefine_all_neighbor_links">
<property name="text">
<string>Refine all neighbor links...</string>
</property>
</action>
<action name="actionRefine_all_loop_closure_links">
<property name="text">
<string>Refine all loop closure links...</string>
</property>
</action>
<action name="actionDetect_more_loop_closures">
<property name="text">
<string>Detect more loop closures...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>