diff --git a/backport-Fix-Bug-between-addText3D-and-QVTKWidget.patch b/backport-Fix-Bug-between-addText3D-and-QVTKWidget.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6eec317569a7220f6e4b1040f6d179f1441dd2b --- /dev/null +++ b/backport-Fix-Bug-between-addText3D-and-QVTKWidget.patch @@ -0,0 +1,45 @@ +From 40bf6c03b2596f5e9e5867e4934899fa17065e8e Mon Sep 17 00:00:00 2001 +From: Shu Dengdeng <60308179+booksuper@users.noreply.github.com> +Date: Mon, 27 Dec 2021 05:09:45 -0600 +Subject: [PATCH] Fix Bug between addText3D and QVTKWidget (#5054) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* Error between addtext3d and qvtkwidget + +When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. +After experiments, it is OK to delete "render - > render()" and it works normally when it does not interact with qvtkwidget + +* Error between addtext3d and qvtkwidget + +When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. +To solve this problem it is OK to delete "render - > render()". I have passed the test on vtk8.0.0, Larshg has tested on vtk9.0.1, and vtk6 and 7 have not been tested. Therefore, the judgment statement of VTK version is added. + +* Fix Bug between addText3D and QVTKWidget + +After successfully testing vtk6,7,just remove “Render->render()” entirely + +* Apply suggestions from code review + +Co-authored-by: Lars Glud + +Co-authored-by: Lars Glud +--- + .../include/pcl/visualization/impl/pcl_visualizer.hpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +index 4eca4e2b74b..3cbed49d6b6 100644 +--- a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp ++++ b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +@@ -755,8 +755,7 @@ pcl::visualization::PCLVisualizer::addText3D ( + textActor->SetCamera (renderer->GetActiveCamera ()); + + renderer->AddActor (textActor); +- renderer->Render (); +- ++ + // Save the pointer/ID pair to the global actor map. If we are saving multiple vtkFollowers + // for multiple viewport + const std::string uid = tid + std::string (i, '*'); diff --git a/backport-Fix-division-by-0-width-in-PointCloud-structured-assign.patch b/backport-Fix-division-by-0-width-in-PointCloud-structured-assign.patch new file mode 100644 index 0000000000000000000000000000000000000000..161d5fa27f0545a07d53abea53b1a58d10253c14 --- /dev/null +++ b/backport-Fix-division-by-0-width-in-PointCloud-structured-assign.patch @@ -0,0 +1,46 @@ +From c1835f442dde8a7567381388f19d6d05ad9d5a83 Mon Sep 17 00:00:00 2001 +From: vcarpani <38493091+vcarpani@users.noreply.github.com> +Date: Sun, 2 Jan 2022 17:03:03 +0100 +Subject: [PATCH] Fix division by 0 width in `PointCloud` structured `assign` + (#5113) + +* Check for width in assign(). + +* Update common/include/pcl/point_cloud.h + +Co-authored-by: Markus Vieth <39675748+mvieth@users.noreply.github.com> + +Co-authored-by: Markus Vieth <39675748+mvieth@users.noreply.github.com> +--- + common/include/pcl/point_cloud.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/common/include/pcl/point_cloud.h b/common/include/pcl/point_cloud.h +index 9440c92249b..fa2172df178 100644 +--- a/common/include/pcl/point_cloud.h ++++ b/common/include/pcl/point_cloud.h +@@ -595,6 +595,12 @@ namespace pcl + inline void + assign(InputIterator first, InputIterator last, index_t new_width) + { ++ if (new_width == 0) { ++ PCL_WARN("Assignment with new_width equal to 0," ++ "setting width to size of the cloud and height to 1\n"); ++ return assign(std::move(first), std::move(last)); ++ } ++ + points.assign(std::move(first), std::move(last)); + width = new_width; + height = size() / width; +@@ -631,6 +637,11 @@ namespace pcl + void + inline assign(std::initializer_list ilist, index_t new_width) + { ++ if (new_width == 0) { ++ PCL_WARN("Assignment with new_width equal to 0," ++ "setting width to size of the cloud and height to 1\n"); ++ return assign(std::move(ilist)); ++ } + points.assign(std::move(ilist)); + width = new_width; + height = size() / width; diff --git a/backport-Fix-segfault-executing-multiscale-feature-persistence.patch b/backport-Fix-segfault-executing-multiscale-feature-persistence.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1d1bfa8ce8d2ecdc050d3507cc903fb1da54e10 --- /dev/null +++ b/backport-Fix-segfault-executing-multiscale-feature-persistence.patch @@ -0,0 +1,65 @@ +From 5e3f984c66db724a8c1c7e09ee5faf2e01e66a01 Mon Sep 17 00:00:00 2001 +From: Markus Vieth <39675748+mvieth@users.noreply.github.com> +Date: Tue, 28 Dec 2021 14:38:03 +0100 +Subject: [PATCH] Fix segfault executing multiscale feature persistence (#5109) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Co-authored-by: Nehil Danış +--- + .../impl/multiscale_feature_persistence.hpp | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/features/include/pcl/features/impl/multiscale_feature_persistence.hpp b/features/include/pcl/features/impl/multiscale_feature_persistence.hpp +index c0afe99575c..932aad8d5e5 100644 +--- a/features/include/pcl/features/impl/multiscale_feature_persistence.hpp ++++ b/features/include/pcl/features/impl/multiscale_feature_persistence.hpp +@@ -95,7 +95,7 @@ pcl::MultiscaleFeaturePersistence::computeFeaturesAtA + { + FeatureCloudPtr feature_cloud (new FeatureCloud ()); + computeFeatureAtScale (scale_values_[scale_i], feature_cloud); +- features_at_scale_[scale_i] = feature_cloud; ++ features_at_scale_.push_back(feature_cloud); + + // Vectorize each feature and insert it into the vectorized feature storage + std::vector > feature_cloud_vectorized; +@@ -147,7 +147,7 @@ pcl::MultiscaleFeaturePersistence::calculateMeanFeatu + feature.cbegin (), mean_feature_.begin (), std::plus<>{}); + } + +- const float factor = std::min(1, normalization_factor); ++ const float factor = std::max(1, normalization_factor); + std::transform(mean_feature_.cbegin(), + mean_feature_.cend(), + mean_feature_.begin(), +@@ -166,11 +166,17 @@ pcl::MultiscaleFeaturePersistence::extractUniqueFeatu + unique_features_indices_.reserve (scale_values_.size ()); + unique_features_table_.reserve (scale_values_.size ()); + ++ std::vector diff_vector; ++ std::size_t size = 0; ++ for (const auto& feature : features_at_scale_vectorized_) ++ { ++ size = std::max(size, feature.size()); ++ } ++ diff_vector.reserve(size); + for (std::size_t scale_i = 0; scale_i < features_at_scale_vectorized_.size (); ++scale_i) + { + // Calculate standard deviation within the scale + float standard_dev = 0.0; +- std::vector diff_vector (features_at_scale_vectorized_[scale_i].size ()); + diff_vector.clear(); + + for (const auto& feature: features_at_scale_vectorized_[scale_i]) +@@ -184,8 +190,8 @@ pcl::MultiscaleFeaturePersistence::extractUniqueFeatu + + // Select only points outside (mean +/- alpha * standard_dev) + std::list indices_per_scale; +- std::vector indices_table_per_scale (features_at_scale_[scale_i]->size (), false); +- for (std::size_t point_i = 0; point_i < features_at_scale_[scale_i]->size (); ++point_i) ++ std::vector indices_table_per_scale (features_at_scale_vectorized_[scale_i].size (), false); ++ for (std::size_t point_i = 0; point_i < features_at_scale_vectorized_[scale_i].size (); ++point_i) + { + if (diff_vector[point_i] > alpha_ * standard_dev) + { diff --git a/backport-Improve-correspondence-rejector-test.patch b/backport-Improve-correspondence-rejector-test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5cd5ef440e5ae0ea4a3e0d414881650857d90f60 --- /dev/null +++ b/backport-Improve-correspondence-rejector-test.patch @@ -0,0 +1,37 @@ +From ba388061b0f9ed9584e57d6019c30b044a657c3e Mon Sep 17 00:00:00 2001 +From: Markus Vieth +Date: Sat, 8 Jan 2022 16:28:28 +0100 +Subject: [PATCH] Improve correspondence rejector test So far, the test was + only run for one specific seed, for which the test passes. But for other + seeds, the test failed roughly 50% of the time. Now the seed is varied (for + better test coverage), and the parameters are adapted so that the test passes + for all seeds. + +--- + test/registration/test_correspondence_rejectors.cpp | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/test/registration/test_correspondence_rejectors.cpp b/test/registration/test_correspondence_rejectors.cpp +index 651a080a8c6..739e626664f 100644 +--- a/test/registration/test_correspondence_rejectors.cpp ++++ b/test/registration/test_correspondence_rejectors.cpp +@@ -104,14 +104,15 @@ TEST (CorrespondenceRejectors, CorrespondenceRejectionPoly) + point.z += nd.run(); + } + +- // Ensure deterministic sampling inside the rejector +- std::srand (1e6); ++ // Test rejector with varying seeds ++ const unsigned int seed = std::time(nullptr); ++ std::srand (seed); + + // Create a rejection object + pcl::registration::CorrespondenceRejectorPoly reject; +- reject.setIterations (10000); ++ reject.setIterations (20000); + reject.setCardinality (3); +- reject.setSimilarityThreshold (0.75f); ++ reject.setSimilarityThreshold (0.8f); + reject.setInputSource (cloud.makeShared ()); + reject.setInputTarget (target.makeShared ()); + diff --git a/backport-Perform-static-cast-+-transform-instead-of-simple-copy-to-avoid-compiler-warning.patch b/backport-Perform-static-cast-+-transform-instead-of-simple-copy-to-avoid-compiler-warning.patch new file mode 100644 index 0000000000000000000000000000000000000000..86eec0be1bb7ab50d93a62d04e73210035e586e0 --- /dev/null +++ b/backport-Perform-static-cast-+-transform-instead-of-simple-copy-to-avoid-compiler-warning.patch @@ -0,0 +1,45 @@ +From 13b48f0de78d8b3a059ac3780afcfdf2b50bc4d6 Mon Sep 17 00:00:00 2001 +From: Kunal Tyagi +Date: Mon, 27 Dec 2021 20:16:16 +0900 +Subject: [PATCH] Perform static cast + transform instead of simple copy to + avoid compiler warning (#5103) + +* Fixes as per suggestions by JasJuang + +* Big oops + +* auto dedude input type in transform +--- + kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp b/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp +index 1b4767b35e7..d276dee8a17 100644 +--- a/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp ++++ b/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp +@@ -171,7 +171,11 @@ knn_search(A& index, B& query, C& k_indices, D& dists, unsigned int k, F& params + // Wrap indices vector (no data allocation) + ::flann::Matrix indices_mat(&indices[0], 1, k); + auto ret = index.knnSearch(query, indices_mat, dists, k, params); +- std::copy(indices.cbegin(), indices.cend(), k_indices.begin()); ++ // cast appropriately ++ std::transform(indices.cbegin(), ++ indices.cend(), ++ k_indices.begin(), ++ [](const auto& x) { return static_cast(x); }); + return ret; + } + +@@ -304,7 +308,11 @@ radius_search(A& index, B& query, C& k_indices, D& dists, float radius, F& param + std::vector> indices(1); + int neighbors_in_radius = index.radiusSearch(query, indices, dists, radius, params); + k_indices.resize(indices[0].size()); +- std::copy(indices[0].cbegin(), indices[0].cend(), k_indices.begin()); ++ // cast appropriately ++ std::transform(indices[0].cbegin(), ++ indices[0].cend(), ++ k_indices.begin(), ++ [](const auto& x) { return static_cast(x); }); + return neighbors_in_radius; + } + diff --git a/pcl.spec b/pcl.spec index 841c4e022f2308630dc5366fea812d48a43cfb0e..95879a4a5af38886b45f4f2e8c98641e41716bee 100644 --- a/pcl.spec +++ b/pcl.spec @@ -3,7 +3,7 @@ Name: pcl Version: 1.12.1 -Release: 2 +Release: 3 Summary: Library for point cloud processing License: BSD URL: http://pointclouds.org/ @@ -15,6 +15,12 @@ Patch0: %{name}-1.12.0-metslib.patch Patch1: %{name}-1.12.0-fedora.patch Patch2: %{name}-1.12.1-boost.patch +Patch3: backport-Fix-Bug-between-addText3D-and-QVTKWidget.patch +Patch4: backport-Perform-static-cast-+-transform-instead-of-simple-copy-to-avoid-compiler-warning.patch +Patch5: backport-Fix-segfault-executing-multiscale-feature-persistence.patch +Patch6: backport-Fix-division-by-0-width-in-PointCloud-structured-assign.patch +Patch7: backport-Improve-correspondence-rejector-test.patch + # For plain building BuildRequires: cmake, gcc-c++, boost-devel # Documentation @@ -85,6 +91,12 @@ Library. %patch0 -p1 -b .metslib %patch1 -p0 -b .fedora %patch2 -p1 -b .boost +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 + # Just to make it obvious we're not using any of these rm -fr recognition/include/pcl/recognition/3rdparty/metslib @@ -158,6 +170,13 @@ make test || true %doc %{_datadir}/doc %changelog +* Thu Aug 22 2024 zhangxingrong - 1.12.1-3 +- Fix Bug between addText3D and QVTKWidget +- Perform static cast + transform instead of simple copy to avoid compiler warning +- Fix segfault executing multiscale feature persistence +- Fix division by 0 width in PointCloud structured assign +- Improve correspondence rejector test + * Mon Sep 11 2023 will_niutao - 1.12.1-2 - delete unused build require