AliceVision integration, see util3d::multiBandTexturing()

This commit is contained in:
matlabbe
2019-10-28 21:16:02 -04:00
parent c16b22de57
commit 2afa76c07c
12 changed files with 717 additions and 69 deletions

View File

@@ -92,6 +92,13 @@ AboutDialog::AboutDialog(QWidget * parent) :
#else
_ui->label_openchisel->setText("No");
#endif
#ifdef RTABMAP_ALICE_VISION
_ui->label_aliceVision->setText("Yes");
_ui->label_aliceVision_license->setEnabled(true);
#else
_ui->label_aliceVision->setText("No");
_ui->label_aliceVision_license->setEnabled(false);
#endif
_ui->label_freenect->setText(CameraFreenect::available()?"Yes":"No");
_ui->label_freenect_license->setEnabled(CameraFreenect::available());

View File

@@ -382,6 +382,7 @@ void ExportCloudsDialog::saveSettings(QSettings & settings, const QString & grou
settings.setValue("mesh_textureExposureFusion", _ui->checkBox_exposureFusion->isChecked());
settings.setValue("mesh_textureBlending", _ui->checkBox_blending->isChecked());
settings.setValue("mesh_textureBlendingDecimation", _ui->comboBox_blendingDecimation->currentIndex());
settings.setValue("mesh_textureMultiband", _ui->checkBox_multiband->isChecked());
settings.setValue("mesh_angle_tolerance", _ui->doubleSpinBox_mesh_angleTolerance->value());
@@ -523,6 +524,7 @@ void ExportCloudsDialog::loadSettings(QSettings & settings, const QString & grou
}
_ui->checkBox_blending->setChecked(settings.value("mesh_textureBlending", _ui->checkBox_blending->isChecked()).toBool());
_ui->comboBox_blendingDecimation->setCurrentIndex(settings.value("mesh_textureBlendingDecimation", _ui->comboBox_blendingDecimation->currentIndex()).toInt());
_ui->checkBox_multiband->setChecked(settings.value("mesh_textureMultiband", _ui->checkBox_multiband->isChecked()).toBool());
_ui->doubleSpinBox_mesh_angleTolerance->setValue(settings.value("mesh_angle_tolerance", _ui->doubleSpinBox_mesh_angleTolerance->value()).toDouble());
_ui->checkBox_mesh_quad->setChecked(settings.value("mesh_quad", _ui->checkBox_mesh_quad->isChecked()).toBool());
@@ -655,6 +657,7 @@ void ExportCloudsDialog::restoreDefaults()
_ui->checkBox_exposureFusion->setChecked(false);
_ui->checkBox_blending->setChecked(true);
_ui->comboBox_blendingDecimation->setCurrentIndex(0);
_ui->checkBox_multiband->setChecked(false);
_ui->doubleSpinBox_mesh_angleTolerance->setValue(15.0);
_ui->checkBox_mesh_quad->setChecked(false);
@@ -833,6 +836,11 @@ void ExportCloudsDialog::updateReconstructionFlavor()
_ui->spinBox_meshMaxPolygons->setEnabled(_ui->comboBox_meshingApproach->currentIndex()!=3);
_ui->label_meshMaxPolygons->setEnabled(_ui->comboBox_meshingApproach->currentIndex()!=3);
#endif
#ifndef RTABMAP_ALICE_VISION
_ui->checkBox_multiband->setEnabled(false);
_ui->label_multiband->setEnabled(false);
#endif
}
}
@@ -860,6 +868,9 @@ void ExportCloudsDialog::setSaveButton()
_ui->checkBox_mesh_quad->setVisible(false);
_ui->checkBox_mesh_quad->setEnabled(false);
_ui->label_quad->setVisible(false);
_ui->checkBox_multiband->setVisible(true);
_ui->checkBox_multiband->setEnabled(true);
_ui->label_multiband->setVisible(true);
updateReconstructionFlavor();
}
@@ -873,6 +884,9 @@ void ExportCloudsDialog::setOkButton()
_ui->checkBox_mesh_quad->setVisible(true);
_ui->checkBox_mesh_quad->setEnabled(true);
_ui->label_quad->setVisible(true);
_ui->checkBox_multiband->setVisible(false);
_ui->checkBox_multiband->setEnabled(false);
_ui->label_multiband->setVisible(false);
updateReconstructionFlavor();
}
@@ -2969,7 +2983,7 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr previousCloud;
pcl::IndicesPtr previousIndices;
Transform previousPose;
for(std::map<int, Transform>::const_iterator iter = poses.begin(); iter!=poses.end() && !_canceled; ++iter, ++index)
for(std::map<int, Transform>::const_iterator iter = poses.lower_bound(1); iter!=poses.end() && !_canceled; ++iter, ++index)
{
int points = 0;
int totalIndices = 0;
@@ -3826,7 +3840,10 @@ void ExportCloudsDialog::saveTextureMeshes(
cv::Mat globalTextures;
bool texturesMerged = _ui->comboBox_meshingTextureSize->isEnabled() && _ui->comboBox_meshingTextureSize->currentIndex() > 0;
if(texturesMerged && mesh->tex_materials.size()>1)
{
{
std::map<int, std::map<int, cv::Vec4d> > gains;
std::map<int, std::map<int, cv::Mat> > blendingGains;
globalTextures = util3d::mergeTextures(
*mesh,
images,
@@ -3843,7 +3860,43 @@ void ExportCloudsDialog::saveTextureMeshes(
blendingDecimation,
_ui->spinBox_textureBrightnessContrastRatioLow->value(),
_ui->spinBox_textureBrightnessContrastRatioHigh->value(),
_ui->checkBox_exposureFusion->isEnabled() && _ui->checkBox_exposureFusion->isChecked());
_ui->checkBox_exposureFusion->isEnabled() && _ui->checkBox_exposureFusion->isChecked(),
0,
0,
&gains,
&blendingGains);
if(_ui->checkBox_multiband->isEnabled() && _ui->checkBox_multiband->isChecked() && mesh->tex_polygons.size() == 1)
{
pcl::PolygonMesh multibandMesh;
multibandMesh.cloud = mesh->cloud;
multibandMesh.polygons = mesh->tex_polygons[0];
success = util3d::multiBandTexturing(
path.toStdString(),
multibandMesh,
poses,
textureVertexToPixels,
images,
calibrations,
0,
_dbDriver,
textureSize,
gains,
blendingGains);
if(success)
{
_progressDialog->incrementStep();
_progressDialog->appendText(tr("Saving the mesh... done."));
QMessageBox::information(this, tr("Save successful!"), tr("Mesh saved to \"%1\"").arg(path));
}
else
{
QMessageBox::warning(this, tr("Save failed!"), tr("Failed to save to \"%1\"").arg(path));
}
return;
}
}
bool singleTexture = mesh->tex_materials.size() == 1;

View File

@@ -162,9 +162,9 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>0</x>
<y>-243</y>
<width>597</width>
<height>774</height>
<y>-387</y>
<width>596</width>
<height>797</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -195,7 +195,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="26" column="0">
<item row="27" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>With FOVIS :</string>
@@ -205,7 +205,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="26" column="2">
<item row="27" column="2">
<widget class="QLabel" name="label_fovis_license">
<property name="text">
<string>GPLv2</string>
@@ -251,7 +251,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="30" column="0">
<item row="31" column="0">
<widget class="QLabel" name="label_35">
<property name="text">
<string>With OKVIS :</string>
@@ -261,7 +261,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="28" column="1">
<item row="29" column="1">
<widget class="QLabel" name="label_dvo">
<property name="text">
<string/>
@@ -307,7 +307,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="30" column="1">
<item row="31" column="1">
<widget class="QLabel" name="label_okvis">
<property name="text">
<string/>
@@ -320,7 +320,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="32" column="0">
<item row="33" column="0">
<widget class="QLabel" name="label_34">
<property name="text">
<string>With MSCKF :</string>
@@ -343,7 +343,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="32" column="1">
<item row="33" column="1">
<widget class="QLabel" name="label_msckf">
<property name="text">
<string/>
@@ -419,7 +419,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="27" column="0">
<item row="28" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>With Viso2 :</string>
@@ -429,7 +429,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="29" column="0">
<item row="30" column="0">
<widget class="QLabel" name="label_28">
<property name="text">
<string>With ORB SLAM 2 :</string>
@@ -449,7 +449,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="29" column="1">
<item row="30" column="1">
<widget class="QLabel" name="label_orbslam2">
<property name="text">
<string/>
@@ -472,7 +472,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="27" column="2">
<item row="28" column="2">
<widget class="QLabel" name="label_viso2_license">
<property name="text">
<string>GPLv3</string>
@@ -512,7 +512,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="26" column="1">
<item row="27" column="1">
<widget class="QLabel" name="label_fovis">
<property name="text">
<string/>
@@ -795,7 +795,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="32" column="2">
<item row="33" column="2">
<widget class="QLabel" name="label_msckf_license">
<property name="text">
<string>Penn Software License</string>
@@ -818,7 +818,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="28" column="2">
<item row="29" column="2">
<widget class="QLabel" name="label_dvo_license">
<property name="text">
<string>GPLv3</string>
@@ -828,7 +828,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="31" column="0">
<item row="32" column="0">
<widget class="QLabel" name="label_36">
<property name="text">
<string>With loam_velodyne :</string>
@@ -897,7 +897,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="31" column="1">
<item row="32" column="1">
<widget class="QLabel" name="label_loam">
<property name="text">
<string/>
@@ -920,7 +920,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="28" column="0">
<item row="29" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>With DVO :</string>
@@ -930,7 +930,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="27" column="1">
<item row="28" column="1">
<widget class="QLabel" name="label_viso2">
<property name="text">
<string/>
@@ -943,7 +943,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="29" column="2">
<item row="30" column="2">
<widget class="QLabel" name="label_orbslam2_license">
<property name="text">
<string>GPLv3</string>
@@ -999,7 +999,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="30" column="2">
<item row="31" column="2">
<widget class="QLabel" name="label_okvis_license">
<property name="text">
<string>BSD</string>
@@ -1009,7 +1009,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="31" column="2">
<item row="32" column="2">
<widget class="QLabel" name="label_loam_license">
<property name="text">
<string>BSD</string>
@@ -1224,6 +1224,39 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="26" column="0">
<widget class="QLabel" name="label_41">
<property name="text">
<string>With AliceVision :</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="26" column="1">
<widget class="QLabel" name="label_aliceVision">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="26" column="2">
<widget class="QLabel" name="label_aliceVision_license">
<property name="text">
<string>MPL2</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -23,9 +23,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-2339</y>
<width>780</width>
<height>4775</height>
<height>4823</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -1978,6 +1978,23 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLabel" name="label_multiband">
<property name="text">
<string>MultiBand texturing. Only available on export and RTAB-Map should be built with AliceVision support.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="checkBox_multiband">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>