mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-03 16:27:46 +08:00
Cleanup gui
Fixed crash when a new location (B merged with previous location A through rehearsal) and then loop on a location already merged with the location A (which is not anymore in WM) Updated rejected hypothesis tag git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@299 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
+12
-2
@@ -1014,7 +1014,7 @@ void Memory::addLoopClosureLink(int oldId, int newId, bool rehearsal)
|
|||||||
if(oldS->getLoopClosureId() > 0 && oldS->getLoopClosureId() == newS->id())
|
if(oldS->getLoopClosureId() > 0 && oldS->getLoopClosureId() == newS->id())
|
||||||
{
|
{
|
||||||
// do nothing, already merged
|
// do nothing, already merged
|
||||||
newS->setWeight(newS->getWeight() + 1);
|
UDEBUG("already merged");
|
||||||
}
|
}
|
||||||
else if(oldS->getLoopClosureId() > 0)
|
else if(oldS->getLoopClosureId() > 0)
|
||||||
{
|
{
|
||||||
@@ -1023,7 +1023,7 @@ void Memory::addLoopClosureLink(int oldId, int newId, bool rehearsal)
|
|||||||
}
|
}
|
||||||
else if(newS->getLoopClosureId() > 0)
|
else if(newS->getLoopClosureId() > 0)
|
||||||
{
|
{
|
||||||
ULOGGER_ERROR("Not supposed to occur!");
|
UFATAL("Not supposed to occur!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1040,6 +1040,16 @@ void Memory::addLoopClosureLink(int oldId, int newId, bool rehearsal)
|
|||||||
|
|
||||||
// update weight
|
// update weight
|
||||||
newS->setWeight(newS->getWeight() + 1 + oldS->getWeight());
|
newS->setWeight(newS->getWeight() + 1 + oldS->getWeight());
|
||||||
|
|
||||||
|
// Find if a location in WM has a loop closure with the old location,
|
||||||
|
// if yes, redirect the loop closure ref to the new one.
|
||||||
|
for(std::map<int, Signature *>::iterator iter=_signatures.begin(); iter != _signatures.end(); ++iter)
|
||||||
|
{
|
||||||
|
if(_stMem.find(iter->first) == _stMem.end() && iter->second->getLoopClosureId() == oldS->id())
|
||||||
|
{
|
||||||
|
iter->second->setLoopClosureId(newS->id());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -855,6 +855,10 @@ void Rtabmap::process()
|
|||||||
timeHypothesesValidation = timer.ticks();
|
timeHypothesesValidation = timer.ticks();
|
||||||
ULOGGER_INFO("timeHypothesesValidation=%f",timeHypothesesValidation);
|
ULOGGER_INFO("timeHypothesesValidation=%f",timeHypothesesValidation);
|
||||||
}
|
}
|
||||||
|
else if(hypotheses.front().second < _loopRatio*_highestHypothesisValue)
|
||||||
|
{
|
||||||
|
rejectedHypothesis = true;
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// Retrieval id update
|
// Retrieval id update
|
||||||
@@ -862,6 +866,7 @@ void Rtabmap::process()
|
|||||||
std::list<std::pair<int, float> > hyp;
|
std::list<std::pair<int, float> > hyp;
|
||||||
// using likelihood (only if in reactivated ids)
|
// using likelihood (only if in reactivated ids)
|
||||||
this->selectHypotheses(likelihood, hyp, false);
|
this->selectHypotheses(likelihood, hyp, false);
|
||||||
|
int lastReactivatedId = _reactivateId;
|
||||||
if(std::find(reactivatedIds.begin(),reactivatedIds.end(), hyp.front().first) != reactivatedIds.end())
|
if(std::find(reactivatedIds.begin(),reactivatedIds.end(), hyp.front().first) != reactivatedIds.end())
|
||||||
{
|
{
|
||||||
_reactivateId = hyp.front().first;
|
_reactivateId = hyp.front().first;
|
||||||
@@ -887,7 +892,7 @@ void Rtabmap::process()
|
|||||||
}
|
}
|
||||||
else if(std::find(reactivatedIds.begin(),reactivatedIds.end(), hypotheses.front().first) != reactivatedIds.end())
|
else if(std::find(reactivatedIds.begin(),reactivatedIds.end(), hypotheses.front().first) != reactivatedIds.end())
|
||||||
{
|
{
|
||||||
if(signaturesReactivated<2 || hypotheses.front().second < _loopRatio*_highestHypothesisValue)
|
if(signaturesReactivated<_maxRetrieved || (hypotheses.front().first == lastReactivatedId && rejectedHypothesis))
|
||||||
{
|
{
|
||||||
// We are loosing the next loop closures (it
|
// We are loosing the next loop closures (it
|
||||||
// can be temporary occlusions/bad images),
|
// can be temporary occlusions/bad images),
|
||||||
|
|||||||
@@ -101,13 +101,13 @@ private slots:
|
|||||||
void clearTheCache();
|
void clearTheCache();
|
||||||
void saveFigures();
|
void saveFigures();
|
||||||
void loadFigures();
|
void loadFigures();
|
||||||
|
void selectScreenCaptureFormat(bool checked);
|
||||||
void updateElapsedTime();
|
void updateElapsedTime();
|
||||||
void processStats(const rtabmap::Statistics & stat);
|
void processStats(const rtabmap::Statistics & stat);
|
||||||
void applyAllPrefSettings();
|
void applyAllPrefSettings();
|
||||||
void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags);
|
void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags);
|
||||||
void applyPrefSettings(const rtabmap::ParametersMap & parameters);
|
void applyPrefSettings(const rtabmap::ParametersMap & parameters);
|
||||||
void processRtabmapEventInit(int status, const QString & info);
|
void processRtabmapEventInit(int status, const QString & info);
|
||||||
void updateItemsShown();
|
|
||||||
void changeImgRateSetting();
|
void changeImgRateSetting();
|
||||||
void changeTimeLimitSetting();
|
void changeTimeLimitSetting();
|
||||||
void captureScreen();
|
void captureScreen();
|
||||||
@@ -157,6 +157,7 @@ private:
|
|||||||
QActionGroup * _selectSourceGrp;
|
QActionGroup * _selectSourceGrp;
|
||||||
|
|
||||||
QString _graphSavingFileName;
|
QString _graphSavingFileName;
|
||||||
|
QString _autoScreenCaptureFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtGui/QAction>
|
||||||
#include "utilite/ULogger.h"
|
#include "utilite/ULogger.h"
|
||||||
|
#include "KeypointItem.h"
|
||||||
|
|
||||||
namespace rtabmap {
|
namespace rtabmap {
|
||||||
|
|
||||||
@@ -37,6 +39,15 @@ ImageView::ImageView(QWidget * parent) :
|
|||||||
this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||||
this->setScene(new QGraphicsScene(this));
|
this->setScene(new QGraphicsScene(this));
|
||||||
connect(this->scene(), SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(updateZoom()));
|
connect(this->scene(), SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(updateZoom()));
|
||||||
|
|
||||||
|
_menu = new QMenu(tr(""), this);
|
||||||
|
_showImage = _menu->addAction(tr("Show image"));
|
||||||
|
_showImage->setCheckable(true);
|
||||||
|
_showImage->setChecked(true);
|
||||||
|
_showFeatures = _menu->addAction(tr("Show features"));
|
||||||
|
_showFeatures->setCheckable(true);
|
||||||
|
_showFeatures->setChecked(true);
|
||||||
|
_saveImage = _menu->addAction(tr("Save picture..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView::~ImageView() {
|
ImageView::~ImageView() {
|
||||||
@@ -49,12 +60,20 @@ void ImageView::resetZoom()
|
|||||||
this->setDragMode(QGraphicsView::NoDrag);
|
this->setDragMode(QGraphicsView::NoDrag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImageView::isImageShown()
|
||||||
|
{
|
||||||
|
return _showImage->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImageView::isFeaturesShown()
|
||||||
|
{
|
||||||
|
return _showFeatures->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
void ImageView::contextMenuEvent(QContextMenuEvent * e)
|
void ImageView::contextMenuEvent(QContextMenuEvent * e)
|
||||||
{
|
{
|
||||||
QMenu menu(tr(""), this);
|
QAction * action = _menu->exec(e->globalPos());
|
||||||
QAction * saveImage = menu.addAction(tr("Save picture..."));
|
if(action == _saveImage)
|
||||||
|
|
||||||
if(menu.exec(e->globalPos()) == saveImage)
|
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
#ifdef QT_SVG_LIB
|
#ifdef QT_SVG_LIB
|
||||||
@@ -71,6 +90,26 @@ void ImageView::contextMenuEvent(QContextMenuEvent * e)
|
|||||||
img.save(text);
|
img.save(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(action == _showFeatures || action == _showImage)
|
||||||
|
{
|
||||||
|
this->updateItemsShown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageView::updateItemsShown()
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem*> items = this->scene()->items();
|
||||||
|
for(int i=0; i<items.size(); ++i)
|
||||||
|
{
|
||||||
|
if(qgraphicsitem_cast<KeypointItem*>(items.at(i)))
|
||||||
|
{
|
||||||
|
items.at(i)->setVisible(_showFeatures->isChecked());
|
||||||
|
}
|
||||||
|
else if(qgraphicsitem_cast<QGraphicsPixmapItem*>(items.at(i)))
|
||||||
|
{
|
||||||
|
items.at(i)->setVisible(_showImage->isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageView::updateZoom()
|
void ImageView::updateZoom()
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
#include <QtGui/QGraphicsView>
|
#include <QtGui/QGraphicsView>
|
||||||
#include <QtCore/QRectF>
|
#include <QtCore/QRectF>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
class QMenu;
|
||||||
|
|
||||||
namespace rtabmap {
|
namespace rtabmap {
|
||||||
|
|
||||||
class ImageView : public QGraphicsView {
|
class ImageView : public QGraphicsView {
|
||||||
@@ -35,6 +38,9 @@ public:
|
|||||||
|
|
||||||
void resetZoom();
|
void resetZoom();
|
||||||
|
|
||||||
|
bool isImageShown();
|
||||||
|
bool isFeaturesShown();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent(QContextMenuEvent * e);
|
virtual void contextMenuEvent(QContextMenuEvent * e);
|
||||||
virtual void wheelEvent(QWheelEvent * e);
|
virtual void wheelEvent(QWheelEvent * e);
|
||||||
@@ -42,10 +48,18 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void updateZoom();
|
void updateZoom();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateItemsShown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _zoom;
|
int _zoom;
|
||||||
int _minZoom;
|
int _minZoom;
|
||||||
QString _savedFileName;
|
QString _savedFileName;
|
||||||
|
|
||||||
|
QMenu * _menu;
|
||||||
|
QAction * _showImage;
|
||||||
|
QAction * _showFeatures;
|
||||||
|
QAction * _saveImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-40
@@ -50,6 +50,7 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
#include <QtGui/QSplashScreen>
|
#include <QtGui/QSplashScreen>
|
||||||
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
#define LOG_FILE_NAME "LogRtabmap.txt"
|
#define LOG_FILE_NAME "LogRtabmap.txt"
|
||||||
#define SHARE_SHOW_LOG_FILE "share/rtabmap/showlogs.m"
|
#define SHARE_SHOW_LOG_FILE "share/rtabmap/showlogs.m"
|
||||||
@@ -75,7 +76,8 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
_oneSecondTimer(0),
|
_oneSecondTimer(0),
|
||||||
_elapsedTime(0),
|
_elapsedTime(0),
|
||||||
_posteriorCurve(0),
|
_posteriorCurve(0),
|
||||||
_likelihoodCurve(0)
|
_likelihoodCurve(0),
|
||||||
|
_autoScreenCaptureFormat("png")
|
||||||
{
|
{
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
|
|
||||||
@@ -166,6 +168,8 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
_ui->menuShow_view->addAction(_ui->dockWidget_likelihood->toggleViewAction());
|
_ui->menuShow_view->addAction(_ui->dockWidget_likelihood->toggleViewAction());
|
||||||
_ui->menuShow_view->addAction(_ui->dockWidget_statsV2->toggleViewAction());
|
_ui->menuShow_view->addAction(_ui->dockWidget_statsV2->toggleViewAction());
|
||||||
_ui->menuShow_view->addAction(_ui->dockWidget_console->toggleViewAction());
|
_ui->menuShow_view->addAction(_ui->dockWidget_console->toggleViewAction());
|
||||||
|
_ui->menuShow_view->addAction(_ui->toolBar->toggleViewAction());
|
||||||
|
_ui->toolBar->setWindowTitle(tr("Control toolbar"));
|
||||||
QAction * a = _ui->menuShow_view->addAction("Status");
|
QAction * a = _ui->menuShow_view->addAction("Status");
|
||||||
a->setCheckable(false);
|
a->setCheckable(false);
|
||||||
connect(a, SIGNAL(triggered(bool)), _initProgressDialog, SLOT(show()));
|
connect(a, SIGNAL(triggered(bool)), _initProgressDialog, SLOT(show()));
|
||||||
@@ -183,6 +187,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
connect(_ui->actionGenerate_map, SIGNAL(triggered()), this , SLOT(generateMap()));
|
connect(_ui->actionGenerate_map, SIGNAL(triggered()), this , SLOT(generateMap()));
|
||||||
connect(_ui->actionDelete_memory, SIGNAL(triggered()), this , SLOT(deleteMemory()));
|
connect(_ui->actionDelete_memory, SIGNAL(triggered()), this , SLOT(deleteMemory()));
|
||||||
connect(_ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(updateEditMenu()));
|
connect(_ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(updateEditMenu()));
|
||||||
|
connect(_ui->actionAuto_screen_capture, SIGNAL(triggered(bool)), this, SLOT(selectScreenCaptureFormat(bool)));
|
||||||
|
|
||||||
#if defined(Q_WS_MAC) or defined(Q_WS_WIN)
|
#if defined(Q_WS_MAC) or defined(Q_WS_WIN)
|
||||||
connect(_ui->actionOpen_working_directory, SIGNAL(triggered()), SLOT(openWorkingDirectory()));
|
connect(_ui->actionOpen_working_directory, SIGNAL(triggered()), SLOT(openWorkingDirectory()));
|
||||||
@@ -219,10 +224,6 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
connect(_ui->doubleSpinBox_stats_timeLimit, SIGNAL(editingFinished()), this, SLOT(changeTimeLimitSetting()));
|
connect(_ui->doubleSpinBox_stats_timeLimit, SIGNAL(editingFinished()), this, SLOT(changeTimeLimitSetting()));
|
||||||
connect(this, SIGNAL(imgRateChanged(double)), _preferencesDialog, SLOT(setImgRate(double)));
|
connect(this, SIGNAL(imgRateChanged(double)), _preferencesDialog, SLOT(setImgRate(double)));
|
||||||
connect(this, SIGNAL(timeLimitChanged(double)), _preferencesDialog, SLOT(setTimeLimit(double)));
|
connect(this, SIGNAL(timeLimitChanged(double)), _preferencesDialog, SLOT(setTimeLimit(double)));
|
||||||
connect(_ui->checkBox_showFeatures, SIGNAL(toggled(bool)), this, SLOT(updateItemsShown()));
|
|
||||||
connect(_ui->checkBox_showFeaturesLoop, SIGNAL(toggled(bool)), this, SLOT(updateItemsShown()));
|
|
||||||
connect(_ui->checkBox_showImage, SIGNAL(toggled(bool)), this, SLOT(updateItemsShown()));
|
|
||||||
connect(_ui->checkBox_showImageLoop, SIGNAL(toggled(bool)), this, SLOT(updateItemsShown()));
|
|
||||||
|
|
||||||
// Statistics from the detector
|
// Statistics from the detector
|
||||||
qRegisterMetaType<rtabmap::Statistics>("rtabmap::Statistics");
|
qRegisterMetaType<rtabmap::Statistics>("rtabmap::Statistics");
|
||||||
@@ -410,7 +411,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
|||||||
}
|
}
|
||||||
QRectF sceneRect = img.rect();
|
QRectF sceneRect = img.rect();
|
||||||
refPixmap = QPixmap::fromImage(img);
|
refPixmap = QPixmap::fromImage(img);
|
||||||
_ui->imageView_source->scene()->addPixmap(refPixmap)->setVisible(this->_ui->checkBox_showImage->isChecked());
|
_ui->imageView_source->scene()->addPixmap(refPixmap)->setVisible(this->_ui->imageView_source->isImageShown());
|
||||||
_ui->imageView_source->setSceneRect(sceneRect);
|
_ui->imageView_source->setSceneRect(sceneRect);
|
||||||
_ui->imageView_loopClosure->setSceneRect(sceneRect);
|
_ui->imageView_loopClosure->setSceneRect(sceneRect);
|
||||||
}
|
}
|
||||||
@@ -439,6 +440,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
|||||||
}
|
}
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
int rejectedHyp = bool(uValue(stat.data(), Statistics::kLoopRejectedHypothesis(), 0.0f));
|
int rejectedHyp = bool(uValue(stat.data(), Statistics::kLoopRejectedHypothesis(), 0.0f));
|
||||||
|
float highestHypothesisValue = uValue(stat.data(), Statistics::kLoopHighest_hypothesis_value(), 0.0f);
|
||||||
if(highestHypothesisId > 0)
|
if(highestHypothesisId > 0)
|
||||||
{
|
{
|
||||||
bool show = true;
|
bool show = true;
|
||||||
@@ -452,7 +454,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
|||||||
}
|
}
|
||||||
_ui->label_matchId->setText(QString("Match ID = %1").arg(stat.loopClosureId()));
|
_ui->label_matchId->setText(QString("Match ID = %1").arg(stat.loopClosureId()));
|
||||||
}
|
}
|
||||||
else if(rejectedHyp)
|
else if(rejectedHyp && highestHypothesisValue >= _preferencesDialog->getLoopThr())
|
||||||
{
|
{
|
||||||
show = _preferencesDialog->imageRejectedShown() || _preferencesDialog->imageHighestHypShown();;
|
show = _preferencesDialog->imageRejectedShown() || _preferencesDialog->imageHighestHypShown();;
|
||||||
if(show)
|
if(show)
|
||||||
@@ -493,7 +495,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
|||||||
|
|
||||||
if(!lcImg.isNull())
|
if(!lcImg.isNull())
|
||||||
{
|
{
|
||||||
_ui->imageView_loopClosure->scene()->addPixmap(QPixmap::fromImage(lcImg))->setVisible(this->_ui->checkBox_showImageLoop->isChecked());
|
_ui->imageView_loopClosure->scene()->addPixmap(QPixmap::fromImage(lcImg))->setVisible(this->_ui->imageView_loopClosure->isImageShown());
|
||||||
}
|
}
|
||||||
if(highestHypothesisIsSaved)
|
if(highestHypothesisIsSaved)
|
||||||
{
|
{
|
||||||
@@ -744,7 +746,7 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
|
|||||||
// GREEN = NEW
|
// GREEN = NEW
|
||||||
item = new KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, QColor(0, 255, 0, alpha));
|
item = new KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, QColor(0, 255, 0, alpha));
|
||||||
}
|
}
|
||||||
item->setVisible(this->_ui->checkBox_showFeatures->isChecked());
|
item->setVisible(this->_ui->imageView_source->isFeaturesShown());
|
||||||
this->_ui->imageView_source->scene()->addItem(item);
|
this->_ui->imageView_source->scene()->addItem(item);
|
||||||
item->setZValue(1);
|
item->setZValue(1);
|
||||||
}
|
}
|
||||||
@@ -786,7 +788,7 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
|
|||||||
// GREEN = NEW
|
// GREEN = NEW
|
||||||
item = new KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, QColor(0, 255, 0, alpha));
|
item = new KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, QColor(0, 255, 0, alpha));
|
||||||
}
|
}
|
||||||
item->setVisible(this->_ui->checkBox_showFeaturesLoop->isChecked());
|
item->setVisible(this->_ui->imageView_loopClosure->isFeaturesShown());
|
||||||
this->_ui->imageView_loopClosure->scene()->addItem(item);
|
this->_ui->imageView_loopClosure->scene()->addItem(item);
|
||||||
item->setZValue(1);
|
item->setZValue(1);
|
||||||
}
|
}
|
||||||
@@ -802,35 +804,6 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateItemsShown()
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem*> items = _ui->imageView_source->scene()->items();
|
|
||||||
for(int i=0; i<items.size(); ++i)
|
|
||||||
{
|
|
||||||
if(qgraphicsitem_cast<KeypointItem*>(items.at(i)))
|
|
||||||
{
|
|
||||||
items.at(i)->setVisible(_ui->checkBox_showFeatures->isChecked());
|
|
||||||
}
|
|
||||||
else if(qgraphicsitem_cast<QGraphicsPixmapItem*>(items.at(i)))
|
|
||||||
{
|
|
||||||
items.at(i)->setVisible(_ui->checkBox_showImage->isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
items = _ui->imageView_loopClosure->scene()->items();
|
|
||||||
for(int i=0; i<items.size(); ++i)
|
|
||||||
{
|
|
||||||
if(qgraphicsitem_cast<KeypointItem*>(items.at(i)))
|
|
||||||
{
|
|
||||||
items.at(i)->setVisible(_ui->checkBox_showFeaturesLoop->isChecked());
|
|
||||||
}
|
|
||||||
else if(qgraphicsitem_cast<QGraphicsPixmapItem*>(items.at(i)))
|
|
||||||
{
|
|
||||||
items.at(i)->setVisible(_ui->checkBox_showImageLoop->isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::resizeEvent(QResizeEvent* anEvent)
|
void MainWindow::resizeEvent(QResizeEvent* anEvent)
|
||||||
{
|
{
|
||||||
_ui->imageView_source->fitInView(_ui->imageView_source->sceneRect(), Qt::KeepAspectRatio);
|
_ui->imageView_source->fitInView(_ui->imageView_source->sceneRect(), Qt::KeepAspectRatio);
|
||||||
@@ -888,7 +861,7 @@ void MainWindow::captureScreen()
|
|||||||
dir.mkdir(targetDir);
|
dir.mkdir(targetDir);
|
||||||
}
|
}
|
||||||
targetDir += "/";
|
targetDir += "/";
|
||||||
QString name = QDateTime::currentDateTime().toString("yyMMddhhmmsszzz") + ".png";
|
QString name = (QDateTime::currentDateTime().toString("yyMMddhhmmsszzz") + ".") + _autoScreenCaptureFormat;
|
||||||
_ui->statusbar->clearMessage();
|
_ui->statusbar->clearMessage();
|
||||||
QPixmap figure = QPixmap::grabWidget(this);
|
QPixmap figure = QPixmap::grabWidget(this);
|
||||||
figure.save(targetDir + name);
|
figure.save(targetDir + name);
|
||||||
@@ -1251,6 +1224,24 @@ void MainWindow::loadFigures()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::selectScreenCaptureFormat(bool checked)
|
||||||
|
{
|
||||||
|
if(checked)
|
||||||
|
{
|
||||||
|
QStringList items;
|
||||||
|
items << QString("png") << QString("jpg");
|
||||||
|
bool ok;
|
||||||
|
QString item = QInputDialog::getItem(this, tr("Select format"), tr("Format:"), items, 0, false, &ok);
|
||||||
|
if(ok && !item.isEmpty())
|
||||||
|
{
|
||||||
|
_autoScreenCaptureFormat = item;
|
||||||
|
}
|
||||||
|
this->captureScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//END ACTIONS
|
||||||
|
|
||||||
// STATES
|
// STATES
|
||||||
// Must be called by the GUI thread, use signal StateChanged()
|
// Must be called by the GUI thread, use signal StateChanged()
|
||||||
void MainWindow::changeState(MainWindow::State newState)
|
void MainWindow::changeState(MainWindow::State newState)
|
||||||
|
|||||||
+19
-23
@@ -1333,7 +1333,8 @@ void OrientableLabel::paintEvent(QPaintEvent* event)
|
|||||||
|
|
||||||
Plot::Plot(QWidget *parent) :
|
Plot::Plot(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
_maxVisibleItems(-1)
|
_maxVisibleItems(-1),
|
||||||
|
_autoScreenCaptureFormat("png")
|
||||||
{
|
{
|
||||||
this->setupUi();
|
this->setupUi();
|
||||||
this->createActions();
|
this->createActions();
|
||||||
@@ -1451,7 +1452,7 @@ void Plot::createActions()
|
|||||||
_aYLabelVertical->setCheckable(true);
|
_aYLabelVertical->setCheckable(true);
|
||||||
_aYLabelVertical->setChecked(true);
|
_aYLabelVertical->setChecked(true);
|
||||||
_aSaveFigure = new QAction(tr("Save figure..."), this);
|
_aSaveFigure = new QAction(tr("Save figure..."), this);
|
||||||
_aAutoScreenCapture = new QAction(tr("Auto screen capture"), this);
|
_aAutoScreenCapture = new QAction(tr("Auto screen capture..."), this);
|
||||||
_aAutoScreenCapture->setCheckable(true);
|
_aAutoScreenCapture->setCheckable(true);
|
||||||
_aClearData = new QAction(tr("Clear data"), this);
|
_aClearData = new QAction(tr("Clear data"), this);
|
||||||
|
|
||||||
@@ -1974,28 +1975,10 @@ void Plot::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
}
|
}
|
||||||
else if(action == _aAutoScreenCapture)
|
else if(action == _aAutoScreenCapture)
|
||||||
{
|
{
|
||||||
this->captureScreen();
|
if(_aAutoScreenCapture->isChecked())
|
||||||
/*if(_aAutoScreenCapture->isChecked())
|
|
||||||
{
|
{
|
||||||
bool ok;
|
this->selectScreenCaptureFormat();
|
||||||
int value = QInputDialog::getInt(this,
|
|
||||||
action->text(),
|
|
||||||
tr("Screen capture delay (ms) [min=100]:"),
|
|
||||||
_autoScreenCaptureDelay,
|
|
||||||
100,
|
|
||||||
2147483647,
|
|
||||||
100,
|
|
||||||
&ok);
|
|
||||||
if(ok)
|
|
||||||
{
|
|
||||||
_autoScreenCaptureDelay = value;
|
|
||||||
this->autoCaptureScreen();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_aAutoScreenCapture->setChecked(false);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
else if(action == _aClearData)
|
else if(action == _aClearData)
|
||||||
{
|
{
|
||||||
@@ -2047,11 +2030,24 @@ void Plot::captureScreen()
|
|||||||
dir.mkdir(targetDir);
|
dir.mkdir(targetDir);
|
||||||
}
|
}
|
||||||
targetDir += "/";
|
targetDir += "/";
|
||||||
QString name = QDateTime::currentDateTime().toString("yyMMddhhmmsszzz") + ".png";
|
QString name = (QDateTime::currentDateTime().toString("yyMMddhhmmsszzz") + ".") + _autoScreenCaptureFormat;
|
||||||
QPixmap figure = QPixmap::grabWidget(this);
|
QPixmap figure = QPixmap::grabWidget(this);
|
||||||
figure.save(targetDir + name);
|
figure.save(targetDir + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plot::selectScreenCaptureFormat()
|
||||||
|
{
|
||||||
|
QStringList items;
|
||||||
|
items << QString("png") << QString("jpg");
|
||||||
|
bool ok;
|
||||||
|
QString item = QInputDialog::getItem(this, tr("Select format"), tr("Format:"), items, 0, false, &ok);
|
||||||
|
if(ok && !item.isEmpty())
|
||||||
|
{
|
||||||
|
_autoScreenCaptureFormat = item;
|
||||||
|
}
|
||||||
|
this->captureScreen();
|
||||||
|
}
|
||||||
|
|
||||||
// for convenience...
|
// for convenience...
|
||||||
ThresholdCurve * Plot::addThreshold(const QString & name, float value, Qt::Orientation orientation)
|
ThresholdCurve * Plot::addThreshold(const QString & name, float value, Qt::Orientation orientation)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -326,7 +326,7 @@ private:
|
|||||||
void setupUi();
|
void setupUi();
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
|
void selectScreenCaptureFormat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlotLegend * _legend;
|
PlotLegend * _legend;
|
||||||
@@ -349,6 +349,7 @@ private:
|
|||||||
QTime _refreshIntervalTime;
|
QTime _refreshIntervalTime;
|
||||||
int _lowestRefreshRate;
|
int _lowestRefreshRate;
|
||||||
QTime _refreshStartTime;
|
QTime _refreshStartTime;
|
||||||
|
QString _autoScreenCaptureFormat;
|
||||||
|
|
||||||
QMenu * _menu;
|
QMenu * _menu;
|
||||||
QAction * _aShowLegend;
|
QAction * _aShowLegend;
|
||||||
|
|||||||
+26
-128
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>839</width>
|
<width>842</width>
|
||||||
<height>447</height>
|
<height>457</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -44,21 +44,23 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QLabel" name="label_22">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-Source-</string>
|
<string>Source:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_refId">
|
<widget class="QLabel" name="label_refId">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -71,7 +73,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -87,59 +89,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_showFeatures">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show features</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_showImage">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show image</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -159,21 +108,23 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_18">
|
<widget class="QLabel" name="label_23">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-Loop closure detection-</string>
|
<string>Match:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_matchId">
|
<widget class="QLabel" name="label_matchId">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -186,7 +137,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -202,59 +153,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_showFeaturesLoop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show features</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_showImageLoop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show image</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</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>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -265,7 +163,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>839</width>
|
<width>842</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -821,7 +719,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Auto screen capture</string>
|
<string>Auto screen capture...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDump_the_prediction_matrix">
|
<action name="actionDump_the_prediction_matrix">
|
||||||
|
|||||||
Reference in New Issue
Block a user