Fixed accumulated words bug in highest hypothesis view

This commit is contained in:
matlabbe
2016-11-27 20:55:53 -05:00
parent 3363772ce5
commit 2f6d7f81cc
3 changed files with 28 additions and 5 deletions

View File

@@ -89,6 +89,7 @@ public:
const QMultiMap<int, rtabmap::KeypointItem *> & getFeatures() const {return _features;}
void clearLines();
void clearFeatures();
void clear();
virtual QSize sizeHint() const;

View File

@@ -651,8 +651,7 @@ void ImageView::updateOpacity()
void ImageView::setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, const cv::Mat & depth, const QColor & color)
{
qDeleteAll(_features);
_features.clear();
clearFeatures();
float xRatio = 0;
float yRatio = 0;
@@ -684,8 +683,7 @@ void ImageView::setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, c
void ImageView::setFeatures(const std::vector<cv::KeyPoint> & features, const cv::Mat & depth, const QColor & color)
{
qDeleteAll(_features);
_features.clear();
clearFeatures();
float xRatio = 0;
float yRatio = 0;
@@ -901,11 +899,21 @@ void ImageView::clearLines()
}
}
void ImageView::clear()
void ImageView::clearFeatures()
{
qDeleteAll(_features);
_features.clear();
if(!_graphicsView->isVisible())
{
this->update();
}
}
void ImageView::clear()
{
clearFeatures();
qDeleteAll(_lines);
_lines.clear();

View File

@@ -3540,6 +3540,10 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
timer.start();
ULOGGER_DEBUG("refWords.size() = %d", refWords.size());
if(refWords.size())
{
_ui->imageView_source->clearFeatures();
}
for(std::multimap<int, cv::KeyPoint>::const_iterator iter = refWords.begin(); iter != refWords.end(); ++iter )
{
int id = iter->first;
@@ -3576,6 +3580,10 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
timer.start();
ULOGGER_DEBUG("loopWords.size() = %d", loopWords.size());
QList<QPair<cv::Point2f, cv::Point2f> > uniqueCorrespondences;
if(loopWords.size())
{
_ui->imageView_loopClosure->clearFeatures();
}
for(std::multimap<int, cv::KeyPoint>::const_iterator iter = loopWords.begin(); iter != loopWords.end(); ++iter )
{
int id = iter->first;
@@ -3643,6 +3651,12 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
deltaX = _ui->imageView_source->width();
}
if(refWords.size() && loopWords.size())
{
_ui->imageView_source->clearLines();
_ui->imageView_loopClosure->clearLines();
}
for(QList<QPair<cv::Point2f, cv::Point2f> >::iterator iter = uniqueCorrespondences.begin();
iter!=uniqueCorrespondences.end();
++iter)