Improved image view scene rect size when no images are there. Added warning when transform cannot be computed because some data are missing.

This commit is contained in:
matlabbe
2024-09-16 15:55:38 -07:00
parent 69ac21f811
commit 0e85bd849c
3 changed files with 30 additions and 2 deletions

View File

@@ -4762,6 +4762,25 @@ void DatabaseViewer::update(int value,
{
ULOGGER_DEBUG("Image depth is empty");
}
if(!rect.isValid())
{
if(data.cameraModels().size())
{
for(unsigned int i=0; i<data.cameraModels().size(); ++i)
{
rect.setWidth(rect.width()+data.cameraModels()[i].imageWidth());
rect.setHeight(std::max((int)rect.height(), data.cameraModels()[i].imageHeight()));
}
}
else if(data.stereoCameraModels().size())
{
for(unsigned int i=0; i<data.cameraModels().size(); ++i)
{
rect.setWidth(rect.width()+data.stereoCameraModels()[i].left().imageWidth());
rect.setHeight(std::max((int)rect.height(), data.stereoCameraModels()[i].left().imageHeight()));
}
}
}
if(rect.isValid())
{
view->setSceneRect(rect);

View File

@@ -2328,7 +2328,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
for(unsigned int i=0; i<signature.sensorData().cameraModels().size(); ++i)
{
sceneRect.setWidth(sceneRect.width()+signature.sensorData().cameraModels()[i].imageWidth());
sceneRect.setHeight(sceneRect.height()+signature.sensorData().cameraModels()[i].imageHeight());
sceneRect.setHeight(std::max((int)sceneRect.height(), signature.sensorData().cameraModels()[i].imageHeight()));
}
}
else if(signature.sensorData().stereoCameraModels().size())
@@ -2336,7 +2336,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
for(unsigned int i=0; i<signature.sensorData().cameraModels().size(); ++i)
{
sceneRect.setWidth(sceneRect.width()+signature.sensorData().stereoCameraModels()[i].left().imageWidth());
sceneRect.setHeight(sceneRect.height()+signature.sensorData().stereoCameraModels()[i].left().imageHeight());
sceneRect.setHeight(std::max((int)sceneRect.height(), signature.sensorData().stereoCameraModels()[i].left().imageHeight()));
}
}
if(sceneRect.isValid())