fix crash on repeating steps in the reconstruction pipeline

This commit is contained in:
Sven Oesau 2024-09-10 14:36:58 +02:00
parent 830d13734d
commit 073309a07f
3 changed files with 12 additions and 14 deletions

View File

@ -2279,6 +2279,7 @@ private:
m_points.clear();
m_points.reserve(count);
m_polygons.clear();
m_polygons.reserve(m_input_polygons.size());
To_exact to_exact;
@ -2321,6 +2322,7 @@ private:
max_count = (std::max<std::size_t>)(max_count, node);
}
m_partition_nodes.clear();
m_partition_nodes.resize(leaf_count);
m_node2partition.resize(max_count + 1, std::size_t(-1));

View File

@ -330,7 +330,7 @@ public:
m_sorting->sort();
}
max_distance = 2 * m_sorting->mean_distance();
max_distance = 4 * m_sorting->mean_distance();
normal_dev = m_sorting->mean_deviation();
min_inliers = m_points.size() * 0.005; // difficult to estimate as it depends on the kind of data, e.g., object scan vs. large scale urban acquisition
}
@ -651,7 +651,9 @@ private:
m_face_inliers.clear();
auto face_range = m_lcc.template one_dart_per_cell<2>();
m_faces_lcc.clear();
m_faces_lcc.reserve(face_range.size());
m_attrib2index_lcc.clear();
for (auto& d : face_range) {
typename LCC::Dart_descriptor dh = m_lcc.dart_descriptor(d);
@ -675,9 +677,13 @@ private:
// Create value arrays for graph cut
m_face_inliers.resize(m_faces_lcc.size());
m_face_area.resize(m_faces_lcc.size());
m_face_area_lcc.clear();
m_face_area_lcc.resize(m_faces_lcc.size());
m_face_neighbors_lcc.clear();
m_face_neighbors_lcc.resize(m_faces_lcc.size(), std::pair<int, int>(-1, -1));
m_neighbors2index_lcc.clear();
m_cost_matrix.clear();
m_cost_matrix.resize(2);
m_cost_matrix[0].resize(m_kinetic_partition.number_of_volumes() + 6, 0);
m_cost_matrix[1].resize(m_kinetic_partition.number_of_volumes() + 6, 0);

View File

@ -110,16 +110,6 @@ public:
return true;
else
return false;
/*
if (pwn_item == nullptr && m_pwn_item == nullptr) {
enable_detection(false);
enable_regularization(false);
enable_partition(false);
enable_reconstruction(false);
}*/
//return pwn_item != nullptr;
}
QList<QAction*> actions() const override
@ -431,7 +421,7 @@ private:
Point_set* points = m_pwn_item->point_set();
m_ksr = new KSR(*points);
/*if (filename == "foam_box" || filename == "foam_box_new") {
if (filename == "foam_box" || filename == "foam_box_new") {
// Shape detection parameters
dock_widget->sdMaxDistanceBox->setValue(0.05);
dock_widget->sdMaxAngleBox->setValue(15);
@ -585,14 +575,14 @@ private:
dock_widget->recGroundCheck->setChecked(false);
dock_widget->recLambdaBox->setValue(0.5);
}
else */{
else {
m_known_file = false;
FT max_distance, max_angle;
std::size_t min_region_size;
m_ksr->estimate_detection_parameters(max_distance, max_angle, min_region_size);
dock_widget->sdMaxDistanceBox->setValue(max_distance);
dock_widget->sdMaxAngleBox->setValue(max_angle);
dock_widget->sdMinRegionSizeBox->setValue(points->number_of_points() * 0.01);
dock_widget->sdMinRegionSizeBox->setValue(min_region_size);
dock_widget->sdkNeighborsBox->setValue(12);
dock_widget->srCoplanarityCheck->setChecked(true);
dock_widget->srMaxOffsetBox->setValue(max_distance * 0.5);