Added OdomBow/FixedLocalMapPath parameter

This commit is contained in:
matlabbe
2015-06-25 16:04:42 -04:00
parent 91a4506956
commit 01f2f1348c
12 changed files with 209 additions and 56 deletions

View File

@@ -246,6 +246,7 @@ private slots:
void updateKpROI();
void changeWorkingDirectory();
void changeDictionaryPath();
void changeOdomBowFixedLocalMapPath();
void readSettingsEnd();
void setupTreeView();
void updateBasicParameter();

View File

@@ -1738,14 +1738,36 @@ void MainWindow::createAndAddCloudToMap(int nodeId, const Transform & pose, int
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
cloud->resize(iter->getWords3().size());
int oi=0;
for(std::multimap<int, pcl::PointXYZ>::const_iterator jter=iter->getWords3().begin(); jter!=iter->getWords3().end(); ++jter)
UASSERT(iter->getWords().size() == iter->getWords3().size());
std::multimap<int, cv::KeyPoint>::const_iterator kter=iter->getWords().begin();
for(std::multimap<int, pcl::PointXYZ>::const_iterator jter=iter->getWords3().begin();
jter!=iter->getWords3().end(); ++jter, ++kter, ++oi)
{
(*cloud)[oi].x = jter->second.x;
(*cloud)[oi].y = jter->second.y;
(*cloud)[oi].z = jter->second.z;
(*cloud)[oi].r = 255;
(*cloud)[oi].g = 255;
(*cloud)[oi++].b = 255;
int u = kter->second.pt.x+0.5;
int v = kter->second.pt.x+0.5;
if(!iter->sensorData().imageRaw().empty() &&
uIsInBounds(u, 0, iter->sensorData().imageRaw().cols-1) &&
uIsInBounds(v, 0, iter->sensorData().imageRaw().rows-1))
{
if(iter->sensorData().imageRaw().channels() == 1)
{
(*cloud)[oi].r = (*cloud)[oi].g = (*cloud)[oi].b = iter->sensorData().imageRaw().at<unsigned char>(u, v);
}
else
{
cv::Vec3b bgr = iter->sensorData().imageRaw().at<cv::Vec3b>(u, v);
(*cloud)[oi].r = bgr.val[0];
(*cloud)[oi].g = bgr.val[1];
(*cloud)[oi].b = bgr.val[2];
}
}
else
{
(*cloud)[oi].r = (*cloud)[oi].g = (*cloud)[oi].b = 255;
}
}
if(!_ui->widget_cloudViewer->addOrUpdateCloud(cloudName, cloud, pose, color))
{

View File

@@ -597,6 +597,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->odom_localHistory->setObjectName(Parameters::kOdomBowLocalHistorySize().c_str());
_ui->odom_bin_nn->setObjectName(Parameters::kOdomBowNNType().c_str());
_ui->odom_bin_nndrRatio->setObjectName(Parameters::kOdomBowNNDR().c_str());
_ui->odom_fixedLocalMapPath->setObjectName(Parameters::kOdomBowFixedLocalMapPath().c_str());
connect(_ui->toolButton_odomBowFixedLocalMap, SIGNAL(clicked()), this, SLOT(changeOdomBowFixedLocalMapPath()));
//Odometry Optical Flow
_ui->odom_flow_winSize->setObjectName(Parameters::kOdomFlowWinSize().c_str());
@@ -2927,6 +2929,23 @@ void PreferencesDialog::changeDictionaryPath()
}
}
void PreferencesDialog::changeOdomBowFixedLocalMapPath()
{
QString path;
if(_ui->odom_fixedLocalMapPath->text().isEmpty())
{
path = QFileDialog::getOpenFileName(this, tr("Database"), this->getWorkingDirectory(), tr("RTAB-Map database files (*.db)"));
}
else
{
path = QFileDialog::getOpenFileName(this, tr("Database"), _ui->odom_fixedLocalMapPath->text(), tr("RTAB-Map database files (*.db)"));
}
if(!path.isEmpty())
{
_ui->odom_fixedLocalMapPath->setText(path);
}
}
void PreferencesDialog::updateRGBDCameraGroupBoxVisibility()
{
_ui->groupBox_openni2->setVisible(_ui->comboBox_cameraRGBD->currentIndex() == kSrcOpenNI2-kSrcOpenNI_PCL);

View File

@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-837</y>
<width>755</width>
<height>1591</height>
<y>0</y>
<width>760</width>
<height>1570</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>24</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -7387,8 +7387,8 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<property name="title">
<string>BOW</string>
</property>
<layout class="QGridLayout" name="gridLayout_29" columnstretch="0,1">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_29" columnstretch="0,1,0,0">
<item row="0" column="1">
<widget class="QSpinBox" name="odom_localHistory">
<property name="minimum">
<number>0</number>
@@ -7404,7 +7404,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="3">
<widget class="QLabel" name="label_190">
<property name="text">
<string>Local history size: If &gt; 0 (example 5000), the odometry will maintain a local map of X maximum words. This will decrease odometry drifting when the camera is not moving.</string>
@@ -7414,7 +7414,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="1">
<widget class="QComboBox" name="odom_bin_nn">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
@@ -7446,7 +7446,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</item>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="3">
<widget class="QLabel" name="label_201">
<property name="text">
<string>Nearest neighbor strategy. FLANN KdTree must be used only with SURF/SIFT. FLANN LSH must be used only with binary feature detector.</string>
@@ -7456,7 +7456,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property>
</widget>
</item>
<item row="2" column="0">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="odom_bin_nndrRatio">
<property name="decimals">
<number>1</number>
@@ -7475,7 +7475,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="3">
<widget class="QLabel" name="label_202">
<property name="text">
<string>NNDR ratio
@@ -7487,6 +7487,26 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="odom_fixedLocalMapPath"/>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_239">
<property name="text">
<string>Path to a fixed map (RTAB-Map's database) to be used for odometry. Odometry will be constraint to this map. RGB-only images can be used if odometry PnP pose estimation is activated.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="toolButton_odomBowFixedLocalMap">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>