diff --git a/.ci/azure-pipelines/ubuntu-variety.yaml b/.ci/azure-pipelines/ubuntu-variety.yaml index 12ae9db0ccb..e085ba0346d 100644 --- a/.ci/azure-pipelines/ubuntu-variety.yaml +++ b/.ci/azure-pipelines/ubuntu-variety.yaml @@ -29,12 +29,12 @@ jobs: displayName: "BuildUbuntuVariety" steps: - script: | - POSSIBLE_VTK_VERSION=("7" "9") \ + POSSIBLE_VTK_VERSION=("9") \ POSSIBLE_CMAKE_CXX_STANDARD=("14" "17" "20") \ POSSIBLE_CMAKE_BUILD_TYPE=("None" "Debug" "Release" "RelWithDebInfo" "MinSizeRel") \ - POSSIBLE_COMPILER_PACKAGE=("g++" "g++-10" "g++-11" "g++-12" "g++-13" "clang" "clang-13" "clang-14" "clang-15") \ - POSSIBLE_CMAKE_C_COMPILER=("gcc" "gcc-10" "gcc-11" "gcc-12" "gcc-13" "clang" "clang-13" "clang-14" "clang-15") \ - POSSIBLE_CMAKE_CXX_COMPILER=("g++" "g++-10" "g++-11" "g++-12" "g++-13" "clang++" "clang++-13" "clang++-14" "clang++-15") \ + POSSIBLE_COMPILER_PACKAGE=("g++" "g++-10" "g++-11" "g++-12" "g++-13" "clang" "clang-13" "clang-14" "clang-15" "clang-16") \ + POSSIBLE_CMAKE_C_COMPILER=("gcc" "gcc-10" "gcc-11" "gcc-12" "gcc-13" "clang" "clang-13" "clang-14" "clang-15" "clang-16") \ + POSSIBLE_CMAKE_CXX_COMPILER=("g++" "g++-10" "g++-11" "g++-12" "g++-13" "clang++" "clang++-13" "clang++-14" "clang++-15" "clang++-16") \ CHOSEN_COMPILER=$[RANDOM%${#POSSIBLE_COMPILER_PACKAGE[@]}] \ dockerBuildArgs="--build-arg VTK_VERSION=${POSSIBLE_VTK_VERSION[$[RANDOM%${#POSSIBLE_VTK_VERSION[@]}]]} --build-arg CMAKE_CXX_STANDARD=${POSSIBLE_CMAKE_CXX_STANDARD[$[RANDOM%${#POSSIBLE_CMAKE_CXX_STANDARD[@]}]]} --build-arg CMAKE_BUILD_TYPE=${POSSIBLE_CMAKE_BUILD_TYPE[$[RANDOM%${#POSSIBLE_CMAKE_BUILD_TYPE[@]}]]} --build-arg COMPILER_PACKAGE=${POSSIBLE_COMPILER_PACKAGE[$CHOSEN_COMPILER]} --build-arg CMAKE_C_COMPILER=${POSSIBLE_CMAKE_C_COMPILER[$CHOSEN_COMPILER]} --build-arg CMAKE_CXX_COMPILER=${POSSIBLE_CMAKE_CXX_COMPILER[$CHOSEN_COMPILER]}" ; \ echo "##vso[task.setvariable variable=dockerBuildArgs]$dockerBuildArgs" diff --git a/common/include/pcl/PCLPointCloud2.h b/common/include/pcl/PCLPointCloud2.h index cf78ad396b1..ec3f9562785 100644 --- a/common/include/pcl/PCLPointCloud2.h +++ b/common/include/pcl/PCLPointCloud2.h @@ -143,7 +143,7 @@ namespace pcl for (std::size_t i = 0; i < v.data.size (); ++i) { s << " data[" << i << "]: "; - s << " " << v.data[i] << std::endl; + s << " " << static_cast(v.data[i]) << std::endl; } s << "is_dense: "; s << " " << v.is_dense << std::endl; diff --git a/common/include/pcl/impl/pcl_base.hpp b/common/include/pcl/impl/pcl_base.hpp index 3caf96c4304..6e548958828 100644 --- a/common/include/pcl/impl/pcl_base.hpp +++ b/common/include/pcl/impl/pcl_base.hpp @@ -162,6 +162,7 @@ pcl::PCLBase::initCompute () catch (const std::bad_alloc&) { PCL_ERROR ("[initCompute] Failed to allocate %lu indices.\n", input_->size ()); + return (false); } for (auto i = indices_size; i < indices_->size (); ++i) { (*indices_)[i] = static_cast(i); } } diff --git a/common/src/pcl_base.cpp b/common/src/pcl_base.cpp index 4b3f18da9a1..b53d0a87ead 100644 --- a/common/src/pcl_base.cpp +++ b/common/src/pcl_base.cpp @@ -124,6 +124,7 @@ pcl::PCLBase::initCompute () catch (const std::bad_alloc&) { PCL_ERROR ("[initCompute] Failed to allocate %lu indices.\n", (input_->width * input_->height)); + return (false); } if (indices_size < indices_->size ()) std::iota(indices_->begin () + indices_size, indices_->end (), indices_size); diff --git a/doc/tutorials/content/compiling_pcl_posix.rst b/doc/tutorials/content/compiling_pcl_posix.rst index 3265435ef80..b77120c819a 100644 --- a/doc/tutorials/content/compiling_pcl_posix.rst +++ b/doc/tutorials/content/compiling_pcl_posix.rst @@ -89,14 +89,13 @@ The following code libraries are **required** for the compilation and usage of t +---------------------------------------------------------------+-----------------+-------------------------+-------------------+ | Logo | Library | Minimum version | Mandatory | +===============================================================+=================+=========================+===================+ -| .. image:: images/posix_building_pcl/boost_logo.png | Boost | | 1.40 (without OpenNI) | pcl_* | -| | | | 1.47 (with OpenNI) | | +| .. image:: images/posix_building_pcl/boost_logo.png | Boost | 1.65 | pcl_* | +---------------------------------------------------------------+-----------------+-------------------------+-------------------+ -| .. image:: images/posix_building_pcl/eigen_logo.png | Eigen | 3.0 | pcl_* | +| .. image:: images/posix_building_pcl/eigen_logo.png | Eigen | 3.3 | pcl_* | +---------------------------------------------------------------+-----------------+-------------------------+-------------------+ -| .. image:: images/posix_building_pcl/flann_logo.png | FLANN | 1.7.1 | pcl_* | +| .. image:: images/posix_building_pcl/flann_logo.png | FLANN | 1.9.1 | pcl_* | +---------------------------------------------------------------+-----------------+-------------------------+-------------------+ -| .. image:: images/posix_building_pcl/vtk_logo.png | VTK | 5.6 | pcl_visualization | +| .. image:: images/posix_building_pcl/vtk_logo.png | VTK | 6.2 | pcl_visualization | +---------------------------------------------------------------+-----------------+-------------------------+-------------------+ Optional diff --git a/doc/tutorials/content/global_hypothesis_verification.rst b/doc/tutorials/content/global_hypothesis_verification.rst index e0a41121352..d30b56cfba0 100644 --- a/doc/tutorials/content/global_hypothesis_verification.rst +++ b/doc/tutorials/content/global_hypothesis_verification.rst @@ -99,7 +99,7 @@ Take a look at the full pipeline: :lines: 245-374 :emphasize-lines: 6,9 -For a full explanation of the above code see `3D Object Recognition based on Correspondence Grouping `_. +For a full explanation of the above code see `3D Object Recognition based on Correspondence Grouping `_. Model-in-Scene Projection diff --git a/doc/tutorials/content/moment_of_inertia.rst b/doc/tutorials/content/moment_of_inertia.rst index 0735f9fe869..262aacd9656 100644 --- a/doc/tutorials/content/moment_of_inertia.rst +++ b/doc/tutorials/content/moment_of_inertia.rst @@ -34,7 +34,7 @@ The code -------- First of all you will need the point cloud for this tutorial. -`This `_ is the one presented on the screenshots. +`This `_ is the one presented on the screenshots. Next what you need to do is to create a file ``moment_of_inertia.cpp`` in any editor you prefer and copy the following code inside of it: .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp diff --git a/doc/tutorials/content/normal_estimation_using_integral_images.rst b/doc/tutorials/content/normal_estimation_using_integral_images.rst index 662bdbe117e..1ddb809a798 100644 --- a/doc/tutorials/content/normal_estimation_using_integral_images.rst +++ b/doc/tutorials/content/normal_estimation_using_integral_images.rst @@ -46,7 +46,8 @@ The following normal estimation methods are available: { COVARIANCE_MATRIX, AVERAGE_3D_GRADIENT, - AVERAGE_DEPTH_CHANGE + AVERAGE_DEPTH_CHANGE, + SIMPLE_3D_GRADIENT }; The COVARIANCE_MATRIX mode creates 9 integral images to compute the normal for diff --git a/doc/tutorials/content/registration_api.rst b/doc/tutorials/content/registration_api.rst index 1988e575cc6..94a3afedfbf 100644 --- a/doc/tutorials/content/registration_api.rst +++ b/doc/tutorials/content/registration_api.rst @@ -84,7 +84,7 @@ keypoints as well. The problem with "feeding two kinect datasets into a correspo Feature descriptors =================== -Based on the keypoints found we have to extract [features](http://www.pointclouds.org/documentation/tutorials/how_features_work.php), where we assemble the information and generate vectors to compare them with each other. Again there +Based on the keypoints found we have to extract `features `_, where we assemble the information and generate vectors to compare them with each other. Again there is a number of feature options to choose from, for example NARF, FPFH, BRIEF or SIFT. diff --git a/doc/tutorials/content/sources/cluster_extraction/cluster_extraction.cpp b/doc/tutorials/content/sources/cluster_extraction/cluster_extraction.cpp index d3cdee44b16..b5953e8f15b 100644 --- a/doc/tutorials/content/sources/cluster_extraction/cluster_extraction.cpp +++ b/doc/tutorials/content/sources/cluster_extraction/cluster_extraction.cpp @@ -9,7 +9,7 @@ #include #include #include - +#include // for setw, setfill int main () diff --git a/doc/tutorials/content/sources/implicit_shape_model/implicit_shape_model.cpp b/doc/tutorials/content/sources/implicit_shape_model/implicit_shape_model.cpp index 7343c9a11a2..cfd8b9f597e 100644 --- a/doc/tutorials/content/sources/implicit_shape_model/implicit_shape_model.cpp +++ b/doc/tutorials/content/sources/implicit_shape_model/implicit_shape_model.cpp @@ -11,7 +11,7 @@ int main (int argc, char** argv) { - if (argc == 0 || argc % 2 == 0) + if (argc < 5 || argc % 2 == 0) // needs at least one training cloud with class id, plus testing cloud with class id (plus name of executable) return (-1); unsigned int number_of_training_clouds = (argc - 3) / 2; diff --git a/doc/tutorials/content/using_pcl_pcl_config.rst b/doc/tutorials/content/using_pcl_pcl_config.rst index a138fd3c2f6..ae3fe9a1832 100644 --- a/doc/tutorials/content/using_pcl_pcl_config.rst +++ b/doc/tutorials/content/using_pcl_pcl_config.rst @@ -23,7 +23,7 @@ CMakeLists.txt that contains: cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(MY_GRAND_PROJECT) - find_package(PCL 1.3 REQUIRED COMPONENTS common io) + find_package(PCL 1.3 REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) @@ -53,7 +53,7 @@ invoking cmake (MY_GRAND_PROJECT_BINARY_DIR). .. code-block:: cmake - find_package(PCL 1.3 REQUIRED COMPONENTS common io) + find_package(PCL 1.3 REQUIRED) We are requesting to find the PCL package at minimum version 1.3. We also say that it is ``REQUIRED`` meaning that cmake will fail @@ -204,4 +204,4 @@ before this one: .. code-block:: cmake - find_package(PCL 1.3 REQUIRED COMPONENTS common io) + find_package(PCL 1.3 REQUIRED) diff --git a/doc/tutorials/content/walkthrough.rst b/doc/tutorials/content/walkthrough.rst index d6da4390c32..971d9a8f78e 100644 --- a/doc/tutorials/content/walkthrough.rst +++ b/doc/tutorials/content/walkthrough.rst @@ -104,7 +104,7 @@ Features **Background** A theoretical primer explaining how features work in PCL can be found in the `3D Features tutorial - `_. + `_. The *features* library contains data structures and mechanisms for 3D feature estimation from point cloud data. 3D features are representations at certain 3D points, or positions, in space, which describe geometrical patterns based on the information available around the point. The data space selected around the query point is usually referred to as the *k-neighborhood*. @@ -247,7 +247,7 @@ Kd-tree **Background** - A theoretical primer explaining how Kd-trees work can be found in the `Kd-tree tutorial `_. + A theoretical primer explaining how Kd-trees work can be found in the `Kd-tree tutorial `_. The *kdtree* library provides the kd-tree data-structure, using `FLANN `_, that allows for fast `nearest neighbor searches `_. @@ -331,7 +331,7 @@ Segmentation The *segmentation* library contains algorithms for segmenting a point cloud into distinct clusters. These algorithms are best suited for processing a point cloud that is composed of a number of spatially isolated regions. In such cases, clustering is often used to break the cloud down into its constituent parts, which can then be processed independently. - A theoretical primer explaining how clustering methods work can be found in the `cluster extraction tutorial `_. + A theoretical primer explaining how clustering methods work can be found in the `cluster extraction tutorial `_. The two figures illustrate the results of plane model segmentation (left) and cylinder model segmentation (right). .. image:: images/plane_model_seg.jpg @@ -378,7 +378,7 @@ Sample Consensus The *sample_consensus* library holds SAmple Consensus (SAC) methods like RANSAC and models like planes and cylinders. These can be combined freely in order to detect specific models and their parameters in point clouds. - A theoretical primer explaining how sample consensus algorithms work can be found in the `Random Sample Consensus tutorial `_ + A theoretical primer explaining how sample consensus algorithms work can be found in the `Random Sample Consensus tutorial `_ Some of the models implemented in this library include: lines, planes, cylinders, and spheres. Plane fitting is often applied to the task of detecting common indoor surfaces, such as walls, floors, and table tops. Other models can be used to detect and segment objects with common geometric structures (e.g., fitting a cylinder model to a mug). @@ -505,10 +505,10 @@ I/O The *io* library contains classes and functions for reading and writing point cloud data (PCD) files, as well as capturing point clouds from a variety of sensing devices. An introduction to some of these capabilities can be found in the following tutorials: - * `The PCD (Point Cloud Data) file format `_ - * `Reading PointCloud data from PCD files `_ - * `Writing PointCloud data to PCD files `_ - * `The OpenNI Grabber Framework in PCL `_ + * `The PCD (Point Cloud Data) file format `_ + * `Reading PointCloud data from PCD files `_ + * `Writing PointCloud data to PCD files `_ + * `The OpenNI Grabber Framework in PCL `_ | @@ -682,7 +682,7 @@ Binaries This section provides a quick reference for some of the common tools in PCL. - * ``pcl_viewer``: a quick way for visualizing PCD (Point Cloud Data) files. More information about PCD files can be found in the `PCD file format tutorial `_. + * ``pcl_viewer``: a quick way for visualizing PCD (Point Cloud Data) files. More information about PCD files can be found in the `PCD file format tutorial `_. **Syntax is: pcl_viewer . **, where options are: diff --git a/features/include/pcl/features/impl/normal_3d_omp.hpp b/features/include/pcl/features/impl/normal_3d_omp.hpp index b1a317598e6..a40b2bb2c2a 100644 --- a/features/include/pcl/features/impl/normal_3d_omp.hpp +++ b/features/include/pcl/features/impl/normal_3d_omp.hpp @@ -47,14 +47,17 @@ template void pcl::NormalEstimationOMP::setNumberOfThreads (unsigned int nr_threads) { - if (nr_threads == 0) #ifdef _OPENMP + if (nr_threads == 0) threads_ = omp_get_num_procs(); -#else - threads_ = 1; -#endif else threads_ = nr_threads; + PCL_DEBUG ("[pcl::NormalEstimationOMP::setNumberOfThreads] Setting number of threads to %u.\n", threads_); +#else + threads_ = 1; + if (nr_threads != 1) + PCL_WARN ("[pcl::NormalEstimationOMP::setNumberOfThreads] Parallelization is requested, but OpenMP is not available! Continuing without parallelization.\n"); +#endif // _OPENMP } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/io/include/pcl/io/io.h b/io/include/pcl/io/io.h index ab579c77a80..62b3289daf4 100644 --- a/io/include/pcl/io/io.h +++ b/io/include/pcl/io/io.h @@ -38,5 +38,6 @@ */ #pragma once +#include // for PCL_DEPRECATED_HEADER PCL_DEPRECATED_HEADER(1, 15, "Please include pcl/common/io.h directly.") #include diff --git a/io/src/lzf_image_io.cpp b/io/src/lzf_image_io.cpp index a5b396f5209..b3b61c638a2 100644 --- a/io/src/lzf_image_io.cpp +++ b/io/src/lzf_image_io.cpp @@ -135,7 +135,7 @@ pcl::io::LZFImageWriter::compress (const char* input, if (itype.size () > 16) { PCL_WARN ("[pcl::io::LZFImageWriter::compress] Image type should be a string of maximum 16 characters! Cutting %s to %s.\n", image_type.c_str (), image_type.substr (0, 15).c_str ()); - itype = itype.substr (0, 15); + itype.resize(16); } if (itype.size () < 16) itype.insert (itype.end (), 16 - itype.size (), ' '); diff --git a/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp b/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp index 2e736eb76ba..94afed0d52b 100644 --- a/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp +++ b/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp @@ -192,8 +192,8 @@ pcl::features::ISMVoteList::findStrongestPeaks ( best_density = peak_densities[i]; strongest_peak = peaks[i]; best_peak_ind = i; + ++peak_counter; } - ++peak_counter; } if( peak_counter == 0 ) diff --git a/segmentation/include/pcl/segmentation/impl/region_growing.hpp b/segmentation/include/pcl/segmentation/impl/region_growing.hpp index 754ecb14e98..be75d0cf7ba 100644 --- a/segmentation/include/pcl/segmentation/impl/region_growing.hpp +++ b/segmentation/include/pcl/segmentation/impl/region_growing.hpp @@ -342,30 +342,27 @@ pcl::RegionGrowing::prepareForSegmentation () template void pcl::RegionGrowing::findPointNeighbours () { - int point_number = static_cast (indices_->size ()); pcl::Indices neighbours; std::vector distances; point_neighbours_.resize (input_->size (), neighbours); if (input_->is_dense) { - for (int i_point = 0; i_point < point_number; i_point++) + for (const auto& point_index: (*indices_)) { - const auto point_index = (*indices_)[i_point]; neighbours.clear (); - search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances); + search_->nearestKSearch (point_index, neighbour_number_, neighbours, distances); point_neighbours_[point_index].swap (neighbours); } } else { - for (int i_point = 0; i_point < point_number; i_point++) + for (const auto& point_index: (*indices_)) { - neighbours.clear (); - const auto point_index = (*indices_)[i_point]; if (!pcl::isFinite ((*input_)[point_index])) continue; - search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances); + neighbours.clear (); + search_->nearestKSearch (point_index, neighbour_number_, neighbours, distances); point_neighbours_[point_index].swap (neighbours); } } diff --git a/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp b/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp index 9ea6cd9cd32..b53a704b09c 100644 --- a/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp +++ b/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp @@ -272,19 +272,17 @@ pcl::RegionGrowingRGB::prepareForSegmentation () template void pcl::RegionGrowingRGB::findPointNeighbours () { - int point_number = static_cast (indices_->size ()); pcl::Indices neighbours; std::vector distances; point_neighbours_.resize (input_->size (), neighbours); point_distances_.resize (input_->size (), distances); - for (int i_point = 0; i_point < point_number; i_point++) + for (const auto& point_index: (*indices_)) { - int point_index = (*indices_)[i_point]; neighbours.clear (); distances.clear (); - search_->nearestKSearch (i_point, region_neighbour_number_, neighbours, distances); + search_->nearestKSearch (point_index, region_neighbour_number_, neighbours, distances); point_neighbours_[point_index].swap (neighbours); point_distances_[point_index].swap (distances); } diff --git a/segmentation/include/pcl/segmentation/min_cut_segmentation.h b/segmentation/include/pcl/segmentation/min_cut_segmentation.h index 888cdc13f42..3059f9e517e 100644 --- a/segmentation/include/pcl/segmentation/min_cut_segmentation.h +++ b/segmentation/include/pcl/segmentation/min_cut_segmentation.h @@ -54,6 +54,7 @@ namespace pcl * The description can be found in the article: * "Min-Cut Based Segmentation of Point Clouds" * \author: Aleksey Golovinskiy and Thomas Funkhouser. + * \ingroup segmentation */ template class PCL_EXPORTS MinCutSegmentation : public pcl::PCLBase diff --git a/segmentation/include/pcl/segmentation/organized_connected_component_segmentation.h b/segmentation/include/pcl/segmentation/organized_connected_component_segmentation.h index 30890706c57..8bf5c5ffe7e 100644 --- a/segmentation/include/pcl/segmentation/organized_connected_component_segmentation.h +++ b/segmentation/include/pcl/segmentation/organized_connected_component_segmentation.h @@ -53,6 +53,7 @@ namespace pcl * See OrganizedMultiPlaneSegmentation for an example application. * * \author Alex Trevor, Suat Gedikli + * \ingroup segmentation */ template class OrganizedConnectedComponentSegmentation : public PCLBase diff --git a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp index 88cec70e390..0f746cabb83 100644 --- a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp @@ -906,6 +906,8 @@ pcl::visualization::PCLVisualizer::addPointCloudNormals ( for (vtkIdType x = 0; x < normals->width; x += point_step) { PointT p = (*cloud)(x, y); + if (!pcl::isFinite(p) || !pcl::isNormalFinite((*normals)(x, y))) + continue; p.x += (*normals)(x, y).normal[0] * scale; p.y += (*normals)(x, y).normal[1] * scale; p.z += (*normals)(x, y).normal[2] * scale; @@ -928,8 +930,10 @@ pcl::visualization::PCLVisualizer::addPointCloudNormals ( nr_normals = (cloud->size () - 1) / level + 1 ; pts = new float[2 * nr_normals * 3]; - for (vtkIdType i = 0, j = 0; j < nr_normals; j++, i = j * level) + for (vtkIdType i = 0, j = 0; (j < nr_normals) && (i < static_cast(cloud->size())); i += level) { + if (!pcl::isFinite((*cloud)[i]) || !pcl::isNormalFinite((*normals)[i])) + continue; PointT p = (*cloud)[i]; p.x += (*normals)[i].normal[0] * scale; p.y += (*normals)[i].normal[1] * scale; @@ -945,6 +949,7 @@ pcl::visualization::PCLVisualizer::addPointCloudNormals ( lines->InsertNextCell (2); lines->InsertCellPoint (2 * j); lines->InsertCellPoint (2 * j + 1); + ++j; } }