Export: added poisson polygon size option

This commit is contained in:
matlabbe
2021-03-13 19:01:09 -05:00
parent 752509fb15
commit 1e4b172a7d
3 changed files with 68 additions and 21 deletions
+5 -1
View File
@@ -231,6 +231,7 @@ ExportCloudsDialog::ExportCloudsDialog(QWidget *parent) :
connect(_ui->checkBox_poisson_outputPolygons, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->checkBox_poisson_manifold, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_poisson_depth, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_poisson_targetPolygonSize, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_poisson_iso, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_poisson_solver, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_poisson_minDepth, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
@@ -442,6 +443,7 @@ void ExportCloudsDialog::saveSettings(QSettings & settings, const QString & grou
settings.setValue("poisson_outputPolygons", _ui->checkBox_poisson_outputPolygons->isChecked());
settings.setValue("poisson_manifold", _ui->checkBox_poisson_manifold->isChecked());
settings.setValue("poisson_depth", _ui->spinBox_poisson_depth->value());
settings.setValue("poisson_polygon_size", _ui->doubleSpinBox_poisson_targetPolygonSize->value());
settings.setValue("poisson_iso", _ui->spinBox_poisson_iso->value());
settings.setValue("poisson_solver", _ui->spinBox_poisson_solver->value());
settings.setValue("poisson_minDepth", _ui->spinBox_poisson_minDepth->value());
@@ -604,6 +606,7 @@ void ExportCloudsDialog::loadSettings(QSettings & settings, const QString & grou
_ui->checkBox_poisson_outputPolygons->setChecked(settings.value("poisson_outputPolygons", _ui->checkBox_poisson_outputPolygons->isChecked()).toBool());
_ui->checkBox_poisson_manifold->setChecked(settings.value("poisson_manifold", _ui->checkBox_poisson_manifold->isChecked()).toBool());
_ui->spinBox_poisson_depth->setValue(settings.value("poisson_depth", _ui->spinBox_poisson_depth->value()).toInt());
_ui->doubleSpinBox_poisson_targetPolygonSize->setValue(settings.value("poisson_polygon_size", _ui->doubleSpinBox_poisson_targetPolygonSize->value()).toDouble());
_ui->spinBox_poisson_iso->setValue(settings.value("poisson_iso", _ui->spinBox_poisson_iso->value()).toInt());
_ui->spinBox_poisson_solver->setValue(settings.value("poisson_solver", _ui->spinBox_poisson_solver->value()).toInt());
_ui->spinBox_poisson_minDepth->setValue(settings.value("poisson_minDepth", _ui->spinBox_poisson_minDepth->value()).toInt());
@@ -758,6 +761,7 @@ void ExportCloudsDialog::restoreDefaults()
_ui->checkBox_poisson_outputPolygons->setChecked(false);
_ui->checkBox_poisson_manifold->setChecked(true);
_ui->spinBox_poisson_depth->setValue(0);
_ui->doubleSpinBox_poisson_targetPolygonSize->setValue(0.03);
_ui->spinBox_poisson_iso->setValue(8);
_ui->spinBox_poisson_solver->setValue(8);
_ui->spinBox_poisson_minDepth->setValue(5);
@@ -2473,7 +2477,7 @@ bool ExportCloudsDialog::getExportedClouds(
depth = 12;
for(int i=6; i<12; ++i)
{
if(mapLength/float(1<<i) < 0.03f)
if(mapLength/float(1<<i) < _ui->doubleSpinBox_poisson_targetPolygonSize->value())
{
depth = i;
break;
+48 -19
View File
@@ -23,9 +23,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-148</y>
<y>-3906</y>
<width>780</width>
<height>5569</height>
<height>5635</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -2747,14 +2747,14 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
<item row="0" column="1">
<widget class="QLabel" name="label_172">
<property name="text">
<string>Depth. Lowering this parameter decreases reconstruction time, but geometry precision is lower. Minimum polygon size: map length / 2^depth), you can start tuning from depth of 8 or 9. 0 means that depth is chosen so that polygon size is just under 3 cm.</string>
<string>Depth. Lowering this parameter decreases reconstruction time, but geometry precision is lower. Minimum polygon size: map length / 2^depth), you can start tuning from depth of 8 or 9. 0 means that depth is chosen so that polygon size is just under target polygon size below.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLabel" name="label_177">
<property name="text">
<string>Samples per node. Set the minimum number of sample points that should fall within an octree node as the octree construction is adapted to sampling density. Note for noise-free samples, small values in the range [1.0 - 5.0] can be used. For more noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a smoother, noise-reduced, reconstruction.</string>
@@ -2764,14 +2764,14 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QSpinBox" name="spinBox_poisson_iso">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="label_176">
<property name="text">
<string>Manifold flag. Enabling this flag tells the reconstructor to add the polygon barycenter when triangulating polygons with more than three vertices.</string>
@@ -2781,7 +2781,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_poisson_samples">
<property name="decimals">
<number>1</number>
@@ -2794,7 +2794,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_poisson_scale">
<property name="decimals">
<number>1</number>
@@ -2807,7 +2807,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="label_181">
<property name="text">
<string>Point weight.</string>
@@ -2817,7 +2817,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLabel" name="label_182">
<property name="text">
<string>Min depth.</string>
@@ -2827,7 +2827,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLabel" name="label_178">
<property name="text">
<string>Iso divide. Set the depth at which a block iso-surface extractor should be used to extract the iso-surface note Using this parameter helps reduce the memory overhead at the cost of a small increase in extraction time. (In practice, we have found that for reconstructions of depth 9 or higher a subdivide depth of 7 or 8 can greatly reduce the memory usage.)</string>
@@ -2837,14 +2837,14 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_poisson_manifold">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QLabel" name="label_179">
<property name="text">
<string>Solver divide. Set the the depth at which a block Gauss-Seidel solver is used to solve the Laplacian equation. Note that using this parameter helps reduce the memory overhead at the cost of a small increase in reconstruction time. (In practice, we have found that for reconstructions of depth 9 or higher a subdivide depth of 7 or 8 can greatly reduce the memory usage.)</string>
@@ -2854,7 +2854,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLabel" name="label_180">
<property name="text">
<string>Scale. Set the ratio between the diameter of the cube used for reconstruction and the diameter of the samples' bounding cube.</string>
@@ -2864,21 +2864,21 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_poisson_outputPolygons">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QSpinBox" name="spinBox_poisson_solver">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLabel" name="label_outputPolygons">
<property name="text">
<string>Output polygons flag. Enabling this flag tells the reconstructor to output a polygon mesh (rather than triangulating of the results of Marching Cubes). Disabled when exporting to file, if mesh decimation is set or when texturing.</string>
@@ -2888,7 +2888,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_poisson_pointWeight">
<property name="decimals">
<number>1</number>
@@ -2898,7 +2898,7 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QSpinBox" name="spinBox_poisson_minDepth">
<property name="minimum">
<number>1</number>
@@ -2912,6 +2912,35 @@ Guidelines: 4 times the voxel size, 0.025 for voxel=0.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_outputPolygons_2">
<property name="text">
<string>Target polygon size used to compute Poisson's depth based on the map size.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_poisson_targetPolygonSize">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.030000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+15 -1
View File
@@ -76,6 +76,7 @@ void showUsage()
" --high_gain # High brightness gain 0-100 (default 10).\n"
" --multiband Enable multiband texturing (AliceVision dependency required).\n"
" --poisson_depth # Set Poisson depth for mesh reconstruction.\n"
" --poisson_size # Set target polygon size when computing Poisson's depth for mesh reconstruction (default 0.03 m).\n"
" --max_polygons # Maximum polygons when creating a mesh (default 500000, set 0 for no limit).\n"
" --max_range # Maximum range of the created clouds (default 4 m, 0 m with --scan).\n"
" --decimation # Depth image decimation before creating the clouds (default 4, 1 with --scan).\n"
@@ -114,6 +115,7 @@ int main(int argc, char * argv[])
bool doBlending = true;
bool doClean = true;
int poissonDepth = 0;
float poissonSize = 0.03;
int maxPolygons = 500000;
int decimation = -1;
float maxRange = -1.0f;
@@ -261,6 +263,18 @@ int main(int argc, char * argv[])
showUsage();
}
}
else if(std::strcmp(argv[i], "--poisson_size") == 0)
{
++i;
if(i<argc-1)
{
poissonSize = uStr2Float(argv[i]);
}
else
{
showUsage();
}
}
else if(std::strcmp(argv[i], "--max_polygons") == 0)
{
++i;
@@ -911,7 +925,7 @@ int main(int argc, char * argv[])
int optimizedDepth = 12;
for(int i=6; i<12; ++i)
{
if(mapLength/float(1<<i) < 0.03f)
if(mapLength/float(1<<i) < poissonSize)
{
optimizedDepth = i;
break;