MainWindow: fixed bg color not shown on loop closures when only scans are used.

This commit is contained in:
matlabbe
2021-05-16 11:15:05 -04:00
parent e9d7fcd7ae
commit 56bc15d7cd

View File

@@ -1931,12 +1931,17 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
} }
// For intermediate empty nodes, keep latest image shown // For intermediate empty nodes, keep latest image shown
if(signature.getWeight() >= 0 && if(signature.getWeight() >= 0)
(!signature.sensorData().imageRaw().empty() || signature.getWords().size()))
{ {
_ui->imageView_source->clear(); _ui->imageView_source->clear();
_ui->imageView_loopClosure->clear(); _ui->imageView_loopClosure->clear();
if(signature.sensorData().imageRaw().empty() && signature.getWords().empty())
{
// To see colors
_ui->imageView_source->setSceneRect(QRect(0,0,640,480));
}
_ui->imageView_source->setBackgroundColor(_ui->imageView_source->getDefaultBackgroundColor()); _ui->imageView_source->setBackgroundColor(_ui->imageView_source->getDefaultBackgroundColor());
_ui->imageView_loopClosure->setBackgroundColor(_ui->imageView_loopClosure->getDefaultBackgroundColor()); _ui->imageView_loopClosure->setBackgroundColor(_ui->imageView_loopClosure->getDefaultBackgroundColor());
@@ -2091,6 +2096,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
} }
//update image views //update image views
if(!signature.sensorData().imageRaw().empty() || signature.getWords().size())
{ {
cv::Mat refImage = signature.sensorData().imageRaw(); cv::Mat refImage = signature.sensorData().imageRaw();
cv::Mat loopImage = loopSignature.sensorData().imageRaw(); cv::Mat loopImage = loopSignature.sensorData().imageRaw();
@@ -2162,6 +2168,11 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
_ui->imageView_loopClosure->setSceneRect(_ui->imageView_source->sceneRect()); _ui->imageView_loopClosure->setSceneRect(_ui->imageView_source->sceneRect());
} }
} }
else if(_ui->imageView_loopClosure->sceneRect().isNull() &&
!_ui->imageView_source->sceneRect().isNull())
{
_ui->imageView_loopClosure->setSceneRect(_ui->imageView_source->sceneRect());
}
UDEBUG("time= %d ms", time.restart()); UDEBUG("time= %d ms", time.restart());