mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
cloudFromDisparity(): adjusting decimation if not valid with current image size. Standalone: ask user to set other parameters to default if some were set on command line.
This commit is contained in:
@@ -595,10 +595,26 @@ pcl::PointCloud<pcl::PointXYZ>::Ptr cloudFromDisparity(
|
|||||||
std::vector<int> * validIndices)
|
std::vector<int> * validIndices)
|
||||||
{
|
{
|
||||||
UASSERT(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1);
|
UASSERT(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1);
|
||||||
UASSERT(imageDisparity.rows % decimation == 0);
|
|
||||||
UASSERT(imageDisparity.cols % decimation == 0);
|
|
||||||
UASSERT(decimation >= 1);
|
UASSERT(decimation >= 1);
|
||||||
|
|
||||||
|
if(imageDisparity.rows % decimation != 0 || imageDisparity.cols % decimation != 0)
|
||||||
|
{
|
||||||
|
int oldDecimation = decimation;
|
||||||
|
while(decimation >= 1)
|
||||||
|
{
|
||||||
|
if(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--decimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(imageDisparity.rows % oldDecimation != 0 || imageDisparity.cols % oldDecimation != 0)
|
||||||
|
{
|
||||||
|
UWARN("Decimation (%d) is not valid for current image size (depth=%dx%d). Highest compatible decimation used=%d.", oldDecimation, imageDisparity.cols, imageDisparity.rows, decimation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||||
|
|
||||||
//cloud.header = cameraInfo.header;
|
//cloud.header = cameraInfo.header;
|
||||||
@@ -686,7 +702,24 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudFromDisparityRGB(
|
|||||||
(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1));
|
(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1));
|
||||||
UASSERT(imageRgb.channels() == 3 || imageRgb.channels() == 1);
|
UASSERT(imageRgb.channels() == 3 || imageRgb.channels() == 1);
|
||||||
UASSERT(decimation >= 1);
|
UASSERT(decimation >= 1);
|
||||||
UASSERT(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0);
|
|
||||||
|
if(imageDisparity.rows % decimation != 0 || imageDisparity.cols % decimation != 0)
|
||||||
|
{
|
||||||
|
int oldDecimation = decimation;
|
||||||
|
while(decimation >= 1)
|
||||||
|
{
|
||||||
|
if(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--decimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(imageDisparity.rows % oldDecimation != 0 || imageDisparity.cols % oldDecimation != 0)
|
||||||
|
{
|
||||||
|
UWARN("Decimation (%d) is not valid for current image size (depth=%dx%d). Highest compatible decimation used=%d.", oldDecimation, imageDisparity.cols, imageDisparity.rows, decimation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public:
|
|||||||
|
|
||||||
rtabmap::ParametersMap getAllParameters() const;
|
rtabmap::ParametersMap getAllParameters() const;
|
||||||
std::string getParameter(const std::string & key) const;
|
std::string getParameter(const std::string & key) const;
|
||||||
void updateParameters(const ParametersMap & parameters);
|
void updateParameters(const ParametersMap & parameters, bool setOtherParametersToDefault = false);
|
||||||
|
|
||||||
//General panel
|
//General panel
|
||||||
int getGeneralLoggerLevel() const;
|
int getGeneralLoggerLevel() const;
|
||||||
|
|||||||
@@ -4081,7 +4081,13 @@ void MainWindow::updateParameters(const ParametersMap & parameters)
|
|||||||
_ui->widget_console->appendMsg(msg);
|
_ui->widget_console->appendMsg(msg);
|
||||||
UWARN(msg.toStdString().c_str());
|
UWARN(msg.toStdString().c_str());
|
||||||
}
|
}
|
||||||
_preferencesDialog->updateParameters(parameters);
|
QMessageBox::StandardButton button = QMessageBox::question(this,
|
||||||
|
tr("Parameters"),
|
||||||
|
tr("Some parameters have been set on command line, do you "
|
||||||
|
"want to set all other RTAB-Map's parameters to default?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
|
QMessageBox::No);
|
||||||
|
_preferencesDialog->updateParameters(parameters, button==QMessageBox::Yes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2889,7 +2889,7 @@ std::string PreferencesDialog::getParameter(const std::string & key) const
|
|||||||
return _parameters.at(key);
|
return _parameters.at(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::updateParameters(const ParametersMap & parameters)
|
void PreferencesDialog::updateParameters(const ParametersMap & parameters, bool setOtherParametersToDefault)
|
||||||
{
|
{
|
||||||
if(parameters.size())
|
if(parameters.size())
|
||||||
{
|
{
|
||||||
@@ -2897,6 +2897,19 @@ void PreferencesDialog::updateParameters(const ParametersMap & parameters)
|
|||||||
{
|
{
|
||||||
this->setParameter(iter->first, iter->second);
|
this->setParameter(iter->first, iter->second);
|
||||||
}
|
}
|
||||||
|
if(setOtherParametersToDefault)
|
||||||
|
{
|
||||||
|
for(ParametersMap::const_iterator iter=Parameters::getDefaultParameters().begin();
|
||||||
|
iter!=Parameters::getDefaultParameters().end();
|
||||||
|
++iter)
|
||||||
|
{
|
||||||
|
if(parameters.find(iter->first) == parameters.end() &&
|
||||||
|
iter->first.compare(Parameters::kRtabmapWorkingDirectory())!=0)
|
||||||
|
{
|
||||||
|
this->setParameter(iter->first, iter->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!this->isVisible())
|
if(!this->isVisible())
|
||||||
{
|
{
|
||||||
this->writeSettings(getTmpIniFilePath());
|
this->writeSettings(getTmpIniFilePath());
|
||||||
|
|||||||
Reference in New Issue
Block a user