From: Jochen Sprickerhof Date: Sat, 25 Sep 2021 16:36:20 +0000 (+0200) Subject: New upstream version 1.12.0+dfsg X-Git-Tag: archive/raspbian/1.14.0+dfsg-2+rpi1^2~10^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b73b4a1ab4e48791a53805e7658f47c0b2e3dfc3;p=pcl.git New upstream version 1.12.0+dfsg --- diff --git a/.ci/azure-pipelines/azure-pipelines.yaml b/.ci/azure-pipelines/azure-pipelines.yaml index a0bf28f0..28154042 100644 --- a/.ci/azure-pipelines/azure-pipelines.yaml +++ b/.ci/azure-pipelines/azure-pipelines.yaml @@ -1,15 +1,33 @@ +trigger: + paths: + exclude: + - doc + - README.md + - CHANGES.md + - CONTRIBUTING.md + +pr: + paths: + exclude: + - doc + - README.md + - CHANGES.md + - CONTRIBUTING.md + resources: containers: + - container: winx86 + image: pointcloudlibrary/env:winx86 + - container: winx64 + image: pointcloudlibrary/env:winx64 - container: fmt image: pointcloudlibrary/fmt - - container: env1604 - image: pointcloudlibrary/env:16.04 - container: env1804 image: pointcloudlibrary/env:18.04 - container: env2004 image: pointcloudlibrary/env:20.04 - - container: doc - image: pointcloudlibrary/doc + - container: env2010 + image: pointcloudlibrary/env:20.10 stages: - stage: formatting @@ -24,26 +42,26 @@ stages: - job: ubuntu displayName: Ubuntu pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 20.04' strategy: matrix: - 16.04 GCC: - CONTAINER: env1604 + 18.04 GCC: # oldest LTS + CONTAINER: env1804 CC: gcc CXX: g++ - BUILD_GPU: OFF + BUILD_GPU: ON CMAKE_ARGS: '-DPCL_WARNINGS_ARE_ERRORS=ON' - 20.04 GCC: - CONTAINER: env2004 + 20.10 GCC: # latest Ubuntu + CONTAINER: env2010 CC: gcc CXX: g++ BUILD_GPU: OFF - CMAKE_ARGS: '' container: $[ variables['CONTAINER'] ] timeoutInMinutes: 0 variables: BUILD_DIR: '$(Agent.BuildDirectory)/build' - CMAKE_CXX_FLAGS: '-Wall -Wextra' + CMAKE_CXX_FLAGS: '-Wall -Wextra -Wnoexcept-type' + DISPLAY: :99.0 # Checked for in CMake steps: - template: build/ubuntu.yaml @@ -75,14 +93,15 @@ stages: # Placement of Ubuntu Clang job after macOS ensures an extra parallel job doesn't need to be created. # Total time per run remains same since macOS is quicker so it finishes earlier, and remaining time is used by this job # Therefore, number of parallel jobs and total run time of entire pipeline remains unchanged even after addition of this job + # The version of Ubuntu is chosen to cover more versions than covered by GCC based CI dependsOn: osx condition: succeededOrFailed() pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 20.04' strategy: matrix: - 18.04 Clang: - CONTAINER: env1804 + 20.04 Clang: + CONTAINER: env2004 CC: clang CXX: clang++ BUILD_GPU: ON @@ -92,6 +111,7 @@ stages: variables: BUILD_DIR: '$(Agent.BuildDirectory)/build' CMAKE_CXX_FLAGS: '-Wall -Wextra' + DISPLAY: :99.0 # Checked for in CMake steps: - template: build/ubuntu.yaml - job: ubuntu_indices @@ -100,11 +120,11 @@ stages: dependsOn: osx condition: succeededOrFailed() pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 20.04' strategy: matrix: - 18.04 Clang: - CONTAINER: env1804 + 20.04 Clang: + CONTAINER: env2004 CC: clang CXX: clang++ INDEX_SIGNED: OFF @@ -122,37 +142,27 @@ stages: displayName: Build MSVC dependsOn: formatting jobs: - - job: vs2017 - displayName: Windows VS2017 Build + - job: Windows + displayName: Windows Build pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' strategy: matrix: x86: + CONTAINER: winx86 PLATFORM: 'x86' ARCHITECTURE: 'x86' - GENERATOR: 'Visual Studio 15 2017' + GENERATOR: '"Visual Studio 16 2019" -A Win32' x64: + CONTAINER: winx64 PLATFORM: 'x64' ARCHITECTURE: 'x86_amd64' - GENERATOR: 'Visual Studio 15 2017 Win64' + GENERATOR: '"Visual Studio 16 2019" -A x64' + container: $[ variables['CONTAINER'] ] timeoutInMinutes: 0 variables: - BUILD_DIR: '$(Agent.WorkFolder)\build' + BUILD_DIR: 'c:\build' CONFIGURATION: 'Release' - VCPKG_ROOT: 'C:\vcpkg' + VCPKG_ROOT: 'c:\vcpkg' steps: - template: build/windows.yaml - - - stage: documentation - displayName: Documentation - dependsOn: [] - jobs: - - template: documentation.yaml - - - stage: tutorials - displayName: Tutorials - dependsOn: build_gcc - jobs: - - template: tutorials.yaml - diff --git a/.ci/azure-pipelines/build/macos.yaml b/.ci/azure-pipelines/build/macos.yaml index 985aaa35..36631166 100644 --- a/.ci/azure-pipelines/build/macos.yaml +++ b/.ci/azure-pipelines/build/macos.yaml @@ -3,7 +3,8 @@ steps: # find the commit hash on a quick non-forced update too fetchDepth: 10 - script: | - brew install cmake pkg-config boost eigen flann glew libusb qhull vtk glew qt5 libpcap libomp brewsci/science/openni + brew install cmake pkg-config boost eigen flann glew libusb qhull vtk glew qt5 libpcap libomp google-benchmark + brew install brewsci/science/openni git clone https://github.com/abseil/googletest.git $GOOGLE_TEST_DIR # the official endpoint changed to abseil/googletest cd $GOOGLE_TEST_DIR && git checkout release-1.8.1 displayName: 'Install Dependencies' @@ -19,6 +20,7 @@ steps: -DPCL_ONLY_CORE_POINT_TYPES=ON \ -DBUILD_simulation=ON \ -DBUILD_global_tests=ON \ + -DBUILD_benchmarks=ON \ -DBUILD_examples=ON \ -DBUILD_tools=ON \ -DBUILD_apps=ON \ diff --git a/.ci/azure-pipelines/build/ubuntu.yaml b/.ci/azure-pipelines/build/ubuntu.yaml index 559dfddd..961e34ea 100644 --- a/.ci/azure-pipelines/build/ubuntu.yaml +++ b/.ci/azure-pipelines/build/ubuntu.yaml @@ -1,4 +1,6 @@ steps: + - script: (nohup Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp -nolisten unix &) + displayName: "Start Xvfb for DISPLAY=$(DISPLAY)" - checkout: self # find the commit hash on a quick non-forced update too fetchDepth: 10 @@ -12,6 +14,7 @@ steps: -DBUILD_simulation=ON \ -DBUILD_surface_on_nurbs=ON \ -DBUILD_global_tests=ON \ + -DBUILD_benchmarks=ON \ -DBUILD_examples=ON \ -DBUILD_tools=ON \ -DBUILD_apps=ON \ diff --git a/.ci/azure-pipelines/build/ubuntu_indices.yaml b/.ci/azure-pipelines/build/ubuntu_indices.yaml index 28f8340d..fd2e8366 100644 --- a/.ci/azure-pipelines/build/ubuntu_indices.yaml +++ b/.ci/azure-pipelines/build/ubuntu_indices.yaml @@ -10,11 +10,6 @@ steps: -DPCL_ONLY_CORE_POINT_TYPES=ON \ -DPCL_INDEX_SIGNED=$INDEX_SIGNED \ -DPCL_INDEX_SIZE=$INDEX_SIZE \ - -DBUILD_geometry=OFF \ - -DBUILD_tools=OFF \ - -DBUILD_kdtree=OFF \ - -DBUILD_ml=OFF \ - -DBUILD_octree=OFF \ -DBUILD_global_tests=ON # Temporary fix to ensure no tests are skipped cmake $(Build.SourcesDirectory) diff --git a/.ci/azure-pipelines/build/windows.yaml b/.ci/azure-pipelines/build/windows.yaml index b2a884c0..c9839847 100644 --- a/.ci/azure-pipelines/build/windows.yaml +++ b/.ci/azure-pipelines/build/windows.yaml @@ -3,43 +3,32 @@ steps: # find the commit hash on a quick non-forced update too fetchDepth: 10 - script: | - echo ##vso[task.setvariable variable=BOOST_ROOT]%BOOST_ROOT_1_69_0% - displayName: 'Set BOOST_ROOT Environment Variable' - - script: | - echo ##vso[task.prependpath]%BOOST_ROOT_1_69_0%\lib - displayName: 'Include Boost Libraries In System PATH' - - script: | - set - displayName: 'Print Environment Variables' - - script: | - vcpkg.exe install eigen3 flann gtest qhull --triplet %PLATFORM%-windows && vcpkg.exe list - displayName: 'Install C++ Dependencies Via Vcpkg' - - script: | - rmdir %VCPKG_ROOT%\downloads /S /Q - rmdir %VCPKG_ROOT%\packages /S /Q - displayName: 'Free Up Space' - - script: | - mkdir %BUILD_DIR% && cd %BUILD_DIR% + mkdir %BUILD_DIR% && cd %BUILD_DIR% && dir cmake $(Build.SourcesDirectory) ^ - -G"%GENERATOR%" ^ + -G%GENERATOR% ^ + -DVCPKG_TARGET_TRIPLET=%PLATFORM%-windows-rel ^ -DCMAKE_BUILD_TYPE="MinSizeRel" ^ - -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^ + -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" ^ -DVCPKG_APPLOCAL_DEPS=ON ^ -DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=ON ^ -DPCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32=ON ^ -DPCL_BUILD_WITH_QHULL_DYNAMIC_LINKING_WIN32=ON ^ -DBUILD_global_tests=ON ^ + -DBUILD_benchmarks=ON ^ -DBUILD_tools=OFF ^ - -DBUILD_surface_on_nurbs=ON + -DBUILD_surface_on_nurbs=ON ^ + -DPCL_DISABLE_VISUALIZATION_TESTS=ON displayName: 'CMake Configuration' - - script: cd %BUILD_DIR% && cmake --build . --config %CONFIGURATION% + - script: | + cd %BUILD_DIR% && cmake --build . --config %CONFIGURATION% displayName: 'Build Library' - - script: cd %BUILD_DIR% && cmake --build . --target tests --config %CONFIGURATION% + - script: | + cd %BUILD_DIR% && cmake --build . --target tests --config %CONFIGURATION% displayName: 'Run Unit Tests' - task: PublishTestResults@2 inputs: testResultsFormat: 'CTest' testResultsFiles: '**/Test*.xml' - searchFolder: '$(Agent.WorkFolder)\build' + searchFolder: '$(BUILD_DIR)' condition: succeededOrFailed() diff --git a/.ci/azure-pipelines/docs-pipeline.yaml b/.ci/azure-pipelines/docs-pipeline.yaml new file mode 100644 index 00000000..e9c787cb --- /dev/null +++ b/.ci/azure-pipelines/docs-pipeline.yaml @@ -0,0 +1,46 @@ +trigger: + paths: + include: + - doc + +pr: + paths: + include: + - doc + +resources: + pipelines: + - pipeline: Build-CI + source: Build + trigger: + stages: + - build_gcc + containers: + - container: fmt # for formatting.yaml + image: pointcloudlibrary/fmt + - container: doc # for documentation.yaml + image: pointcloudlibrary/doc + - container: env1804 # for tutorials.yaml + image: pointcloudlibrary/env:18.04 + +stages: + - stage: formatting + displayName: Formatting + # if docs pipeline triggered by build_gcc stage, + # the formatting stage has already run, thus it + # won't run for a second time here. + condition: ne(variables['Build.Reason'], 'ResourceTrigger') + jobs: + - template: formatting.yaml + + - stage: documentation + displayName: Documentation + condition: in(dependencies.formatting.result, 'Succeeded', 'SucceededWithIssues', 'Skipped') + jobs: + - template: documentation.yaml + + - stage: tutorials + displayName: Tutorials + condition: in(dependencies.documentation.result, 'Succeeded', 'SucceededWithIssues') + jobs: + - template: tutorials.yaml diff --git a/.ci/azure-pipelines/documentation.yaml b/.ci/azure-pipelines/documentation.yaml index 9eaacba3..9cfcbfb8 100644 --- a/.ci/azure-pipelines/documentation.yaml +++ b/.ci/azure-pipelines/documentation.yaml @@ -2,7 +2,7 @@ jobs: - job: documentation displayName: Generate Documentation pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 20.04' container: doc variables: BUILD_DIR: '$(Agent.BuildDirectory)/build' diff --git a/.ci/azure-pipelines/env.yml b/.ci/azure-pipelines/env.yml index d3c6f7aa..00ca0a80 100644 --- a/.ci/azure-pipelines/env.yml +++ b/.ci/azure-pipelines/env.yml @@ -9,12 +9,14 @@ trigger: paths: include: - .dev/docker/env/Dockerfile + - .dev/docker/windows - .ci/azure-pipelines/env.yml pr: paths: include: - .dev/docker/env/Dockerfile + - .dev/docker/windows - .ci/azure-pipelines/env.yml schedules: @@ -32,32 +34,39 @@ variables: dockerHubID: "pointcloudlibrary" jobs: -- job: BuildAndPush +- job: BuildAndPushUbuntu timeoutInMinutes: 360 displayName: "Env" pool: vmImage: 'ubuntu-latest' strategy: matrix: - Ubuntu 16.04: - CUDA_VERSION: 9.2 - UBUNTU_DISTRO: 16.04 - USE_CUDA: false - VTK_VERSION: 6 - tag: 16.04 Ubuntu 18.04: CUDA_VERSION: 10.2 UBUNTU_DISTRO: 18.04 USE_CUDA: true VTK_VERSION: 6 - tag: 18.04 + TAG: 18.04 Ubuntu 20.04: - CUDA_VERSION: 11 + CUDA_VERSION: 11.2.1 UBUNTU_DISTRO: 20.04 VTK_VERSION: 7 - # nvidia-cuda docker image has not been released for 20.04 yet + USE_CUDA: true + TAG: 20.04 + Ubuntu 20.10: + CUDA_VERSION: 11.2.1 + UBUNTU_DISTRO: 20.10 + VTK_VERSION: 7 + # nvidia-cuda docker image has not been released for 20.10 yet + USE_CUDA: "" + TAG: 20.10 + Ubuntu 21.04: + CUDA_VERSION: 11.2.1 + UBUNTU_DISTRO: 21.04 + VTK_VERSION: 9 + # nvidia-cuda docker image has not been released for 21.04 yet USE_CUDA: "" - tag: 20.04 + TAG: 21.04 steps: - task: Docker@2 displayName: "Build docker image" @@ -69,12 +78,12 @@ jobs: --build-arg UBUNTU_DISTRO=$(UBUNTU_DISTRO) --build-arg USE_CUDA=$(USE_CUDA) --build-arg VTK_VERSION=$(VTK_VERSION) - -t $(dockerHubID)/env:$(tag) + -t $(dockerHubID)/env:$(TAG) dockerfile: '$(Build.SourcesDirectory)/.dev/docker/env/Dockerfile' - tags: "$(tag)" + tags: "$(TAG)" - script: | set -x - docker run --rm -v "$(Build.SourcesDirectory)":/pcl $(dockerHubID)/env:$(tag) bash -c ' \ + docker run --rm -v "$(Build.SourcesDirectory)":/pcl $(dockerHubID)/env:$(TAG) bash -c ' \ mkdir /pcl/build && cd /pcl/build && \ cmake /pcl \ -DCMAKE_BUILD_TYPE="Release" \ @@ -89,6 +98,57 @@ jobs: command: push containerRegistry: $(dockerHub) repository: $(dockerHubID)/env - tags: "$(tag)" + tags: "$(TAG)" + condition: and(eq(variables['Build.Repository.Name'], 'PointCloudLibrary/pcl'), + eq(variables['Build.SourceBranch'], 'refs/heads/master')) +- job: BuildAndPushWindows + timeoutInMinutes: 360 + displayName: "Env" + pool: + vmImage: 'windows-2019' + strategy: + matrix: + Winx86: + PLATFORM: x86 + TAG: winx86 + GENERATOR: "'Visual Studio 16 2019' -A Win32" + VCPKGCOMMIT: 2bc10eae2fb0b8c7c098325c4e9d82aa5d0329d9 + Winx64: + PLATFORM: x64 + TAG: winx64 + GENERATOR: "'Visual Studio 16 2019' -A x64" + VCPKGCOMMIT: master + steps: + - task: Docker@2 + displayName: "Build docker image" + inputs: + command: build + arguments: | + --no-cache + --build-arg PLATFORM=$(PLATFORM) + --build-arg VCPKGCOMMIT=$(VCPKGCOMMIT) + -t $(dockerHubID)/env:$(TAG) + dockerfile: '$(Build.SourcesDirectory)/.dev/docker/windows/Dockerfile' + tags: "$(TAG)" + + - script: > + docker run --rm -v "$(Build.SourcesDirectory)":c:\pcl $(dockerHubID)/env:$(TAG) + powershell -command "mkdir c:\pcl\build; cd c:\pcl\build; + cmake c:\pcl -G$(GENERATOR) + -DVCPKG_TARGET_TRIPLET=$(PLATFORM)-windows-rel + -DCMAKE_BUILD_TYPE='Release' + -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake + -DPCL_ONLY_CORE_POINT_TYPES=ON + -DBUILD_io:BOOL=OFF + -DBUILD_kdtree:BOOL=OFF; + cmake --build . " + displayName: 'Verify Dockerimage' + - task: Docker@2 + displayName: "Push docker image" + inputs: + command: push + containerRegistry: $(dockerHub) + repository: $(dockerHubID)/env + tags: "$(TAG)" condition: and(eq(variables['Build.Repository.Name'], 'PointCloudLibrary/pcl'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) diff --git a/.ci/azure-pipelines/formatting.yaml b/.ci/azure-pipelines/formatting.yaml index 0033e72f..342e56ff 100644 --- a/.ci/azure-pipelines/formatting.yaml +++ b/.ci/azure-pipelines/formatting.yaml @@ -2,7 +2,7 @@ jobs: - job: formatting displayName: Check code formatting pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 20.04' container: fmt steps: - checkout: self diff --git a/.ci/azure-pipelines/release.yaml b/.ci/azure-pipelines/release.yaml index 225c846f..b088cf29 100644 --- a/.ci/azure-pipelines/release.yaml +++ b/.ci/azure-pipelines/release.yaml @@ -48,6 +48,20 @@ stages: timeoutInMinutes: 360 pool: vmImage: 'ubuntu-latest' + strategy: + matrix: + INT32: + PCL_INDEX_SIGNED: true + PCL_INDEX_SIZE: 32 + UINT32: + PCL_INDEX_SIGNED: false + PCL_INDEX_SIZE: 32 + INT64: + PCL_INDEX_SIGNED: true + PCL_INDEX_SIZE: 64 + UINT64: + PCL_INDEX_SIGNED: false + PCL_INDEX_SIZE: 64 variables: tag: "release" steps: @@ -61,6 +75,8 @@ stages: arguments: | --no-cache -t $(dockerHubID)/release:$(tag) + --build-arg PCL_INDEX_SIGNED=$(PCL_INDEX_SIGNED) + --build-arg PCL_INDEX_SIZE=$(PCL_INDEX_SIZE) dockerfile: '$(Build.SourcesDirectory)/.dev/docker/release/Dockerfile' tags: "$(tag)" - stage: ROS diff --git a/.ci/azure-pipelines/tutorials.yaml b/.ci/azure-pipelines/tutorials.yaml index 05922c47..6ca14276 100644 --- a/.ci/azure-pipelines/tutorials.yaml +++ b/.ci/azure-pipelines/tutorials.yaml @@ -2,8 +2,8 @@ jobs: - job: tutorials displayName: Building Tutorials pool: - vmImage: 'Ubuntu 16.04' - container: env1604 + vmImage: 'Ubuntu 20.04' + container: env1804 timeoutInMinutes: 0 variables: BUILD_DIR: '$(Agent.BuildDirectory)/build' diff --git a/.ci/scripts/build_tutorials.sh b/.ci/scripts/build_tutorials.sh index 169128ec..c26d02d9 100755 --- a/.ci/scripts/build_tutorials.sh +++ b/.ci/scripts/build_tutorials.sh @@ -73,7 +73,7 @@ for DIRECTORY in "$SOURCE_DIR"/*/ ; do TUTORIAL_BUILD_DIR="$BUILD_DIR/$NAME" mkdir -p "$TUTORIAL_BUILD_DIR" && cd "$TUTORIAL_BUILD_DIR" || exit echo "Configuring tutorial: $NAME" - if ! cmake "$TUTORIAL_SOURCE_DIR" -DPCL_DIR="$INSTALL_DIR" -DCMAKE_CXX_FLAGS="-Werror"; then + if ! cmake "$TUTORIAL_SOURCE_DIR" -DPCL_DIR="$INSTALL_DIR" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror"; then STATUS="cmake error" else echo "Building tutorial: $NAME" diff --git a/.dev/docker/env/Dockerfile b/.dev/docker/env/Dockerfile index 6e06fb78..e2dcb662 100644 --- a/.dev/docker/env/Dockerfile +++ b/.dev/docker/env/Dockerfile @@ -14,6 +14,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y \ + xvfb \ cmake \ g++ \ clang \ @@ -26,6 +27,7 @@ RUN apt-get update \ libflann-dev \ libglew-dev \ libgtest-dev \ + libbenchmark-dev \ libopenni-dev \ libopenni2-dev \ libproj-dev \ diff --git a/.dev/docker/release/Dockerfile b/.dev/docker/release/Dockerfile index b7afd81b..8b156a98 100644 --- a/.dev/docker/release/Dockerfile +++ b/.dev/docker/release/Dockerfile @@ -3,6 +3,9 @@ FROM debian:testing ARG VTK_VERSION=7 ENV DEBIAN_FRONTEND=noninteractive +ARG PCL_INDEX_SIGNED=true +ARG PCL_INDEX_SIZE=32 + # Add sources so we can just install build-dependencies of PCL RUN sed -i 's/^deb \(.*\)$/deb \1\ndeb-src \1/' /etc/apt/sources.list \ && apt update \ @@ -57,6 +60,8 @@ RUN cd \ -DBUILD_tools=ON -DBUILD_tracking=ON -DBUILD_visualization=ON \ -DBUILD_apps_cloud_composer=OFF -DBUILD_apps_modeler=ON \ -DBUILD_apps_point_cloud_editor=ON -DBUILD_apps_in_hand_scanner=ON \ + -DPCL_INDEX_SIGNED=${PCL_INDEX_SIGNED} \ + -DPCL_INDEX_SIZE=${PCL_INDEX_SIZE} \ && make install -j2 \ && cd \ && rm -fr pcl diff --git a/.dev/docker/windows/Dockerfile b/.dev/docker/windows/Dockerfile new file mode 100644 index 00000000..6901105d --- /dev/null +++ b/.dev/docker/windows/Dockerfile @@ -0,0 +1,47 @@ +# escape=` + +FROM mcr.microsoft.com/windows/servercore:ltsc2019 + +# Use "--build-arg platform=x64" for 64 bit or x86 for 32 bit. +ARG PLATFORM + +# Use to set specific commit to checkout +ARG VCPKGCOMMIT + +# Download channel for fixed install. +ARG CHANNEL_BASE_URL=https://aka.ms/vs/16/release + +ADD $CHANNEL_BASE_URL/channel C:\TEMP\VisualStudio.chman + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +# Download and install Build Tools for Visual Studio 2019 for native desktop +RUN wget $Env:CHANNEL_BASE_URL/vs_buildtools.exe -OutFile 'C:\TEMP\vs_buildtools.exe'; ` + Start-Process -FilePath C:\TEMP\vs_buildtools.exe -ArgumentList ` + "--quiet", ` + "--norestart", ` + "--nocache", ` + "--installPath", ` + "C:\BuildTools", ` + "--wait", ` + "--channelUri", ` + "C:\TEMP\VisualStudio.chman", ` + "--installChannelUri", ` + "C:\TEMP\VisualStudio.chman", ` + "--add", ` + "Microsoft.VisualStudio.Workload.VCTools", ` + "--includeRecommended" ` + -Wait -PassThru; ` + del c:\temp\vs_buildtools.exe; + +RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); ` + choco install cmake git --installargs 'ADD_CMAKE_TO_PATH=System' -y --no-progress + +RUN git clone https://github.com/microsoft/vcpkg.git; cd vcpkg; git checkout $Env:VCPKGCOMMIT; + +# To explicit set VCPKG to only build Release version of the libraries. +COPY $PLATFORM'-windows-rel.cmake' 'c:\vcpkg\triplets\'$PLATFORM'-windows-rel.cmake' + +RUN cd .\vcpkg; ` + .\bootstrap-vcpkg.bat; ` + .\vcpkg install boost flann eigen3 qhull vtk[qt,opengl] gtest benchmark --triplet $Env:PLATFORM-windows-rel --clean-after-build; diff --git a/.dev/docker/windows/x64-windows-rel.cmake b/.dev/docker/windows/x64-windows-rel.cmake new file mode 100644 index 00000000..f6c40253 --- /dev/null +++ b/.dev/docker/windows/x64-windows-rel.cmake @@ -0,0 +1,4 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_BUILD_TYPE release) diff --git a/.dev/docker/windows/x86-windows-rel.cmake b/.dev/docker/windows/x86-windows-rel.cmake new file mode 100644 index 00000000..0a277bdb --- /dev/null +++ b/.dev/docker/windows/x86-windows-rel.cmake @@ -0,0 +1,4 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_BUILD_TYPE release) diff --git a/.dev/format.sh b/.dev/format.sh index 6acff827..dba26190 100755 --- a/.dev/format.sh +++ b/.dev/format.sh @@ -8,7 +8,7 @@ format() { # don't use a directory with whitespace - local whitelist="apps/3d_rec_framework apps/modeler 2d ml octree simulation stereo tracking" + local whitelist="apps/3d_rec_framework apps/include apps/modeler apps/src benchmarks 2d geometry ml octree simulation stereo tracking registration gpu/containers" local PCL_DIR="${2}" local formatter="${1}" diff --git a/2d/CMakeLists.txt b/2d/CMakeLists.txt index 8bd5411e..437d23fb 100644 --- a/2d/CMakeLists.txt +++ b/2d/CMakeLists.txt @@ -31,8 +31,6 @@ set(impl_incs ) if(${VTK_FOUND}) - set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") - include("${VTK_USE_FILE}") set(VTK_IO_TARGET_LINK_LIBRARIES vtkCommon vtkWidgets vtkIO vtkImaging) endif() diff --git a/CHANGES.md b/CHANGES.md index 533d35f4..5fd55b71 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,227 @@ # ChangeList +## = 1.12.0 (2021.07.07) = + +PCL 1.12.0 enables custom index size and type, from `int16_t` to `uint64_t`, allowing +users to have as small or large clouds as they wish. 1.12 also comes with improved +support for VTK and CUDA, along with making existing functionality more user friendly. + +This is all on top of the usual bug-fixes and performance improvements across the board + +### Notable changes + +**New features** *added to PCL* + +* **[sample_consensus]** Add SIMD implementations to some countWithinDistance functions [[#3519](https://github.com/PointCloudLibrary/pcl/pull/3519)] +* **[io]** Enable Real Sense 2 grabber for all platforms [[#4471](https://github.com/PointCloudLibrary/pcl/pull/4471)] +* **[visualization]** add ellipsoid shape to pcl_visualizer [[#4531](https://github.com/PointCloudLibrary/pcl/pull/4531)] +* **[common]** Add `constexpr` to static member functions for point types, add macro for `if constexpr` [[#4735](https://github.com/PointCloudLibrary/pcl/pull/4735)] +* **[ci]** Use windows docker image in CI. [[#4426](https://github.com/PointCloudLibrary/pcl/pull/4426)] +* **[common]** Add pcl log stream macros [[#4595](https://github.com/PointCloudLibrary/pcl/pull/4595)] + +**Deprecation** *of public APIs, scheduled to be removed after two minor releases* + +* **[common]** Modify index type for vertices [[#4256](https://github.com/PointCloudLibrary/pcl/pull/4256)] +* **[gpu]** Add square distances to GPU knnSearch API [[#4322](https://github.com/PointCloudLibrary/pcl/pull/4322)] +* **[gpu]** Add square distances to ApproxNearestSearch [[#4340](https://github.com/PointCloudLibrary/pcl/pull/4340)] +* Deprecate unused ease-of-internal-use headers [[#4367](https://github.com/PointCloudLibrary/pcl/pull/4367)] +* **[registration]** Deprecate `TransformationEstimationDQ` in favor of `TransformationEstimationDualQuaternion` [[#4425](https://github.com/PointCloudLibrary/pcl/pull/4425)] +* **[segmentation]** Deprecate unused `max_label` in `extractLabeledEuclideanClusters` [[#4105](https://github.com/PointCloudLibrary/pcl/pull/4105)] +* **[surface]** MLS: correct typo in `principle` by using `principal` instead [[#4505](https://github.com/PointCloudLibrary/pcl/pull/4505)] +* Deprecate unneeded meta-headers [[#4628](https://github.com/PointCloudLibrary/pcl/pull/4628)] +* **[apps][tracking]** pyramidal klt: switch keypoints_status_ to int vector [[#4681](https://github.com/PointCloudLibrary/pcl/pull/4681)] +* Properly remove remaining items deprecated for version 1.12, deprecate `uniform_sampling.h` [[#4688](https://github.com/PointCloudLibrary/pcl/pull/4688)] +* **[recognition]** Add deprecation for incorrectly installed headers [[#4650](https://github.com/PointCloudLibrary/pcl/pull/4650)] + +**Removal** *of the public APIs deprecated in previous releases* + +* Remove deprecated items as scheduled in preparation of v1.12 (except `concatenatePointCloud`) [[#4341](https://github.com/PointCloudLibrary/pcl/pull/4341)] +* **[apps]** Remove unused code in persistence_utils.h [[#4500](https://github.com/PointCloudLibrary/pcl/pull/4500)] +* Properly remove remaining items deprecated for version 1.12, deprecate `uniform_sampling.h` [[#4688](https://github.com/PointCloudLibrary/pcl/pull/4688)] + +**Behavior changes** *in classes, apps, or tools* + +* **[registration]** Don't move, or copy ICP [[#4167](https://github.com/PointCloudLibrary/pcl/pull/4167)] +* **[common]** Fix PointXYZRGBA ctor, set A as 255 by default [[#4799](https://github.com/PointCloudLibrary/pcl/pull/4799)] + +**API changes** *that did not go through the proper deprecation and removal cycle* + +* **[common]** modify index type for PCLImage [[#4257](https://github.com/PointCloudLibrary/pcl/pull/4257)] +* **[registration]** Don't move, or copy ICP [[#4167](https://github.com/PointCloudLibrary/pcl/pull/4167)] +* **[kdtree]** KdTree: handle 0 or negative k for nearestKSearch [[#4430](https://github.com/PointCloudLibrary/pcl/pull/4430)] +* **[common]** Use `std::array` instead of C-array for ColorLUT [[#4489](https://github.com/PointCloudLibrary/pcl/pull/4489)] +* **[tracking]** Use SFINAE instead of relying on macro `PCL_TRACKING_NORMAL_SUPPORTED` [[#4643](https://github.com/PointCloudLibrary/pcl/pull/4643)] +* **[gpu]** Export and template extract clusters [[#4196](https://github.com/PointCloudLibrary/pcl/pull/4196)] +* **[common]** Added `namespace pcl` to free functions: `aligned_{malloc/free}` [[#4742](https://github.com/PointCloudLibrary/pcl/pull/4742)] + +**ABI changes** *that are still API compatible* + +* **[registration]** Refactoring and Bugfix of NDT [[#4180](https://github.com/PointCloudLibrary/pcl/pull/4180)] +* **[common]** modify index types for PCLPointCloud2 [[#4199](https://github.com/PointCloudLibrary/pcl/pull/4199)] +* **[common]** Modify index type for vertices [[#4256](https://github.com/PointCloudLibrary/pcl/pull/4256)] +* **[common]** Modify index type for PCLPointField [[#4228](https://github.com/PointCloudLibrary/pcl/pull/4228)] +* **[surface]** Enabled multithreading in Poisson surface reconstruction [[#4332](https://github.com/PointCloudLibrary/pcl/pull/4332)] +* **[io]** Allow file_io to read large point clouds depending on PCL config [[#4331](https://github.com/PointCloudLibrary/pcl/pull/4331)] +* **[sample_consensus]** Allow user to apply arbitrary constraint on models in sample consensus [[#4260](https://github.com/PointCloudLibrary/pcl/pull/4260)] +* **[tracking]** Use SFINAE instead of relying on macro `PCL_TRACKING_NORMAL_SUPPORTED` [[#4643](https://github.com/PointCloudLibrary/pcl/pull/4643)] +* **[features]** Move the init of static variables to library load time [[#4640](https://github.com/PointCloudLibrary/pcl/pull/4640)] +* **[octree]** Octree2BufBase: Fix bug that contents from previous buffer appear in current buffer [[#4642](https://github.com/PointCloudLibrary/pcl/pull/4642)] + +### Changes grouped by module + +#### CMake: + +* Update `pcl_find_boost` to allow compilation with Boost 1.74 [[#4330](https://github.com/PointCloudLibrary/pcl/pull/4330)] +* Variable needs to be expanded when checking for `EXT_DEPS` [[#4353](https://github.com/PointCloudLibrary/pcl/pull/4353)] +* Update pcl_find_cuda.cmake to contain all supported architectures [[#4400](https://github.com/PointCloudLibrary/pcl/pull/4400)] +* Add support for VTK 9 [[#4262](https://github.com/PointCloudLibrary/pcl/pull/4262)] +* Refactor cmake find script of libusb [[#4483](https://github.com/PointCloudLibrary/pcl/pull/4483)] +* Add AVX for windows [[#4598](https://github.com/PointCloudLibrary/pcl/pull/4598)] +* Add SSE definitions for SSE 4.1 and 4.2 [[#4596](https://github.com/PointCloudLibrary/pcl/pull/4596)] + +#### libpcl_common: + +* **[ABI break]** modify index types for PCLPointCloud2 [[#4199](https://github.com/PointCloudLibrary/pcl/pull/4199)] +* **[API break]** modify index type for PCLImage [[#4257](https://github.com/PointCloudLibrary/pcl/pull/4257)] +* **[ABI break][deprecation]** Modify index type for vertices [[#4256](https://github.com/PointCloudLibrary/pcl/pull/4256)] +* **[ABI break]** Modify index type for PCLPointField [[#4228](https://github.com/PointCloudLibrary/pcl/pull/4228)] +* Allow PCL_DEPRECATED to detect and help remove deprecations before release [[#4336](https://github.com/PointCloudLibrary/pcl/pull/4336)] +* Allow conversion of PointCloud with more than 32-bit size rows/columns [[#4343](https://github.com/PointCloudLibrary/pcl/pull/4343)] +* Improve routing for `transformPointCloud` [[#4398](https://github.com/PointCloudLibrary/pcl/pull/4398)] +* Correct typo in `transformPlane` [[#4396](https://github.com/PointCloudLibrary/pcl/pull/4396)] +* **[API break]** Use `std::array` instead of C-array for ColorLUT [[#4489](https://github.com/PointCloudLibrary/pcl/pull/4489)] +* Set header in two toPCLPointCloud2 functions [[#4538](https://github.com/PointCloudLibrary/pcl/pull/4538)] +* Add more operators to `PointCloud` to prevent perf regression in refactoring [[#4397](https://github.com/PointCloudLibrary/pcl/pull/4397)] +* Make sure that organized point clouds are still organized after transformPointCloud [[#4488](https://github.com/PointCloudLibrary/pcl/pull/4488)] +* **[API break]** Added `namespace pcl` to free functions: `aligned_{malloc/free}` [[#4742](https://github.com/PointCloudLibrary/pcl/pull/4742)] +* **[new feature]** Add `constexpr` to static member functions for point types, add macro for `if constexpr` [[#4735](https://github.com/PointCloudLibrary/pcl/pull/4735)] +* Fix `PolygonMesh::concatenate` and its unit test [[#4745](https://github.com/PointCloudLibrary/pcl/pull/4745)] +* **[behavior change]** Fix PointXYZRGBA ctor, set A as 255 by default [[#4799](https://github.com/PointCloudLibrary/pcl/pull/4799)] +* Remove pseudo-template-instantiations in eigen.h to reduce compilation time [[#4788](https://github.com/PointCloudLibrary/pcl/pull/4788)] +* **[new feature]** Add pcl log stream macros [[#4595](https://github.com/PointCloudLibrary/pcl/pull/4595)] + +#### libpcl_features: + +* **[ABI break]** Move the init of static variables to library load time [[#4640](https://github.com/PointCloudLibrary/pcl/pull/4640)] +* Use correct cloud for checking finite-ness in fpfh [[#4720](https://github.com/PointCloudLibrary/pcl/pull/4720)] + +#### libpcl_filters: + +* Improve performance of median filter by using `nth_element` [[#4360](https://github.com/PointCloudLibrary/pcl/pull/4360)] +* Fix the covariance calculation as suggested by @zxd123 [[#4466](https://github.com/PointCloudLibrary/pcl/pull/4466)] +* Filters: fix wrong initialization of covariance in VoxelGridCovariance [[#4556](https://github.com/PointCloudLibrary/pcl/pull/4556)] +* Fix application of setMinimumPointsNumberPerVoxel for PCLPointCloud2 implementation of VoxelGrid [[#4389](https://github.com/PointCloudLibrary/pcl/pull/4389)] +* Adding tests for CropHull and using hull_cloud instead of input in getHullCloudRange [[#3976](https://github.com/PointCloudLibrary/pcl/pull/3976)] + +#### libpcl_gpu: + +* **[deprecation]** Add square distances to GPU knnSearch API [[#4322](https://github.com/PointCloudLibrary/pcl/pull/4322)] +* **[deprecation]** Add square distances to ApproxNearestSearch [[#4340](https://github.com/PointCloudLibrary/pcl/pull/4340)] +* **[API break]** Export and template extract clusters [[#4196](https://github.com/PointCloudLibrary/pcl/pull/4196)] +* Update support for CUDA arch in CMake and `convertSMVer2Cores` [[#4748](https://github.com/PointCloudLibrary/pcl/pull/4748)] +* Add ability to download contiguous chunk of memory to host using `Device{Array,Memory}` [[#4741](https://github.com/PointCloudLibrary/pcl/pull/4741)] +* Speeding up GPU clustering using smarter download strategy and memory allocations [[#4677](https://github.com/PointCloudLibrary/pcl/pull/4677)] + +#### libpcl_io: + +* **[ABI break]** Allow file_io to read large point clouds depending on PCL config [[#4331](https://github.com/PointCloudLibrary/pcl/pull/4331)] +* Improve PCD read performance (more than 50%) by reusing `istringstream` [[#4339](https://github.com/PointCloudLibrary/pcl/pull/4339)] +* **[new feature]** Enable Real Sense 2 grabber for all platforms [[#4471](https://github.com/PointCloudLibrary/pcl/pull/4471)] +* Throw error if the device bluffs about its capability [[#4141](https://github.com/PointCloudLibrary/pcl/pull/4141)] +* Fix crash in Dinast Grabber due to bad initialization of device handle [[#4484](https://github.com/PointCloudLibrary/pcl/pull/4484)] +* PLY face definition accepts uint fields as well [[#4492](https://github.com/PointCloudLibrary/pcl/pull/4492)] +* Prevent segfault in vtk2mesh [[#4581](https://github.com/PointCloudLibrary/pcl/pull/4581)] +* Prevent exception in PCDReader for misformed PCD files [[#4566](https://github.com/PointCloudLibrary/pcl/pull/4566)] +* Enable arbitary size Indices for Octree module [[#4350](https://github.com/PointCloudLibrary/pcl/pull/4350)] +* Fix addition of Carriage Return to PCD files. [[#4727](https://github.com/PointCloudLibrary/pcl/pull/4727)] +* Support Ensenso SDK 3.0 for ensenso_grabber [[#4751](https://github.com/PointCloudLibrary/pcl/pull/4751)] +* Specify no face elements in PLY files (from point cloud) to make them interoperable with VTK [[#4774](https://github.com/PointCloudLibrary/pcl/pull/4774)] + +#### libpcl_kdtree: + +* **[API break]** KdTree: handle 0 or negative k for nearestKSearch [[#4430](https://github.com/PointCloudLibrary/pcl/pull/4430)] + +#### libpcl_ml: + +* Fix un-initialized centroids bug (k-means) [[#4570](https://github.com/PointCloudLibrary/pcl/pull/4570)] + +#### libpcl_octree: + +* Enable arbitary size Indices for Octree module [[#4350](https://github.com/PointCloudLibrary/pcl/pull/4350)] +* Fix problems in octree search functions when using dynamic depth [[#4657](https://github.com/PointCloudLibrary/pcl/pull/4657)] +* **[ABI break]** Octree2BufBase: Fix bug that contents from previous buffer appear in current buffer [[#4642](https://github.com/PointCloudLibrary/pcl/pull/4642)] + +#### libpcl_outofcore: + +* Fix compile issue due to missing include under MSVC 2019 [[#4755](https://github.com/PointCloudLibrary/pcl/pull/4755)] + +#### libpcl_recognition: + +* **[deprecation]** Add deprecation for incorrectly installed headers [[#4650](https://github.com/PointCloudLibrary/pcl/pull/4650)] + +#### libpcl_registration: + +* **[ABI break]** Refactoring and Bugfix of NDT [[#4180](https://github.com/PointCloudLibrary/pcl/pull/4180)] +* **[API break][behavior change]** Don't move, or copy ICP [[#4167](https://github.com/PointCloudLibrary/pcl/pull/4167)] +* **[deprecation]** Deprecate `TransformationEstimationDQ` in favor of `TransformationEstimationDualQuaternion` [[#4425](https://github.com/PointCloudLibrary/pcl/pull/4425)] +* Fix force no recompute [[#4535](https://github.com/PointCloudLibrary/pcl/pull/4535)] +* Skip non-finite points for Pyramid Feature Matching [[#4711](https://github.com/PointCloudLibrary/pcl/pull/4711)] + +#### libpcl_sample_consensus: + +* **[ABI break]** Allow user to apply arbitrary constraint on models in sample consensus [[#4260](https://github.com/PointCloudLibrary/pcl/pull/4260)] +* Improve logging errors during sample consensus model registration [[#4381](https://github.com/PointCloudLibrary/pcl/pull/4381)] +* **[new feature]** Add SIMD implementations to some countWithinDistance functions [[#3519](https://github.com/PointCloudLibrary/pcl/pull/3519)] +* Faster sample consensus functions [[#4424](https://github.com/PointCloudLibrary/pcl/pull/4424)] +* Fix and improve MLESAC [[#4575](https://github.com/PointCloudLibrary/pcl/pull/4575)] +* Improve logging in module `sample_consensus` [[#4261](https://github.com/PointCloudLibrary/pcl/pull/4261)] + +#### libpcl_search: + +* Faster organized search [[#4496](https://github.com/PointCloudLibrary/pcl/pull/4496)] +* Add access to boxSearch [[#4282](https://github.com/PointCloudLibrary/pcl/pull/4282)] + +#### libpcl_segmentation: + +* **[deprecation]** Deprecate unused `max_label` in `extractLabeledEuclideanClusters` [[#4105](https://github.com/PointCloudLibrary/pcl/pull/4105)] +* Fix the dotproduct calculation in `extractEuclideanClusters` for smooth surfaces [[#4162](https://github.com/PointCloudLibrary/pcl/pull/4162)] +* Make euclidean clustering with normals faster [[#4551](https://github.com/PointCloudLibrary/pcl/pull/4551)] + +#### libpcl_surface: + +* **[ABI break]** Enabled multithreading in Poisson surface reconstruction [[#4332](https://github.com/PointCloudLibrary/pcl/pull/4332)] +* Add stdlib header for malloc in poisson (bugfix for gcc-5) [[#4376](https://github.com/PointCloudLibrary/pcl/pull/4376)] +* Always update counter and prevent overflow access in poisson4 octree [[#4316](https://github.com/PointCloudLibrary/pcl/pull/4316)] +* Add missing include to nurbs_solve_umfpack.cpp [[#4571](https://github.com/PointCloudLibrary/pcl/pull/4571)] +* **[deprecation]** MLS: correct typo in `principle` by using `principal` instead [[#4505](https://github.com/PointCloudLibrary/pcl/pull/4505)] + +#### libpcl_visualization: + +* Add support for VTK 9 [[#4262](https://github.com/PointCloudLibrary/pcl/pull/4262)] +* **[new feature]** add ellipsoid shape to pcl_visualizer [[#4531](https://github.com/PointCloudLibrary/pcl/pull/4531)] + +#### PCL Apps: + +* **[removal]** Remove unused code in persistence_utils.h [[#4500](https://github.com/PointCloudLibrary/pcl/pull/4500)] +* **[deprecation]** pyramidal klt: switch keypoints_status_ to int vector [[#4681](https://github.com/PointCloudLibrary/pcl/pull/4681)] + +#### PCL Docs: + +* Update documentation to be coherent with the style guide [[#4771](https://github.com/PointCloudLibrary/pcl/pull/4771)] + +#### PCL Tutorials: + +* Replace PassThrough with removeNaNFromPointCloud in 3 tutorials [[#4760](https://github.com/PointCloudLibrary/pcl/pull/4760)] + +#### PCL Tools: + +* Fix virtual scanner [[#4730](https://github.com/PointCloudLibrary/pcl/pull/4730)] + +#### CI: + +* Make windows build on c:\ drive to fix out-of-disk-space errors [[#4382](https://github.com/PointCloudLibrary/pcl/pull/4382)] +* **[new feature]** Use windows docker image in CI. [[#4426](https://github.com/PointCloudLibrary/pcl/pull/4426)] + ## = 1.11.1 (13.08.2020) = Apart from the usual serving of bug-fixes and speed improvements, PCL 1.11.1 brings in diff --git a/CMakeLists.txt b/CMakeLists.txt index e5aa7f40..63b38df6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "build type default to RelWithDebInfo, set to Release to improve performance" FORCE) endif() -project(PCL VERSION 1.11.1) +project(PCL VERSION 1.12.0) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) ### ---[ Find universal dependencies @@ -90,18 +90,25 @@ if(PCL_ENABLE_SSE AND "${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}" PCL_CHECK_FOR_SSE() endif() +# check for AVX flags for windows +if(PCL_ENABLE_AVX AND "${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") + include("${PCL_SOURCE_DIR}/cmake/pcl_find_avx.cmake") + PCL_CHECK_FOR_AVX() +endif() + # ---[ Unix/Darwin/Windows specific flags if(CMAKE_COMPILER_IS_GNUCXX) if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi=11") + string(APPEND CMAKE_CXX_FLAGS " -Wabi=11") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi") - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS_STR}") - if(PCL_WARNINGS_ARE_ERRORS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + string(APPEND CMAKE_CXX_FLAGS " -Wabi") endif() + string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS}") + endif() + + if(PCL_WARNINGS_ARE_ERRORS) + string(APPEND CMAKE_CXX_FLAGS " -Werror -fno-strict-aliasing") endif() if("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL "" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") @@ -110,10 +117,10 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(WIN32) if(PCL_SHARED_LIBS) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols -Wl,--enable-auto-import") + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-all-symbols -Wl,--enable-auto-import") if(MINGW) add_definitions("-DBOOST_THREAD_USE_LIB") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition") + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--allow-multiple-definition") endif() else() add_definitions("-DBOOST_LIB_DIAGNOSTIC -DBOOST_THREAD_USE_LIB") @@ -127,20 +134,20 @@ if(CMAKE_COMPILER_IS_MSVC) add_compile_options(/bigobj) if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd4800 /wd4521 /wd4251 /wd4275 /wd4305 /wd4355 ${SSE_FLAGS_STR}") + string(APPEND CMAKE_CXX_FLAGS " /fp:precise /wd4800 /wd4521 /wd4251 /wd4275 /wd4305 /wd4355 ${SSE_FLAGS} ${AVX_FLAGS}") # Add extra code generation/link optimizations if(CMAKE_MSVC_CODE_LINK_OPTIMIZATION AND (NOT BUILD_CUDA) AND (NOT BUILD_GPU)) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") + string(APPEND CMAKE_CXX_FLAGS_RELEASE " /GL") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /LTCG /OPT:REF") + string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /LTCG") else() message("Global optimizations /GL has been turned off, as it doesn't work with nvcc/thrust") endif() # /MANIFEST:NO") # please, don't disable manifest generation, otherwise crash at start for vs2008 if(PCL_WARNINGS_ARE_ERRORS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + string(APPEND CMAKE_CXX_FLAGS " /WX") endif() include(ProcessorCount) @@ -150,11 +157,11 @@ if(CMAKE_COMPILER_IS_MSVC) # Usage of COMPILE_LANGUAGE generator expression for MSVC in add_compile_options requires at least CMake 3.11, see https://gitlab.kitware.com/cmake/cmake/issues/17435 if(MSVC_MP EQUAL 0) # MSVC_MP is 0 in case the information cannot be determined by ProcessorCount => fallback - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + string(APPEND CMAKE_C_FLAGS " /MP") + string(APPEND CMAKE_CXX_FLAGS " /MP") elseif(MSVC_MP GREATER 1) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${MSVC_MP}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${MSVC_MP}") + string(APPEND CMAKE_C_FLAGS " /MP${MSVC_MP}") + string(APPEND CMAKE_CXX_FLAGS " /MP${MSVC_MP}") endif() else() if(MSVC_MP EQUAL 0) @@ -168,8 +175,8 @@ if(CMAKE_COMPILER_IS_MSVC) endif() if(CMAKE_GENERATOR STREQUAL "Ninja") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FS") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS") + string(APPEND CMAKE_C_FLAGS " /FS") + string(APPEND CMAKE_CXX_FLAGS " /FS") endif() endif() @@ -189,7 +196,7 @@ if(CMAKE_COMPILER_IS_CLANG) if("${CMAKE_CXX_FLAGS}" STREQUAL "") set(CMAKE_CXX_FLAGS "-ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof ${SSE_FLAGS_STR}") # Unfortunately older Clang versions do not have this: -Wno-unnamed-type-template-args if(APPLE AND WITH_CUDA AND CUDA_FOUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") + string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++") endif() endif() set(CLANG_LIBRARIES "stdc++") @@ -263,8 +270,8 @@ if(WITH_OPENMP) find_package(OpenMP COMPONENTS C CXX) endif() if(OpenMP_FOUND) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}") + string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}") if(${CMAKE_VERSION} VERSION_LESS "3.7") message(STATUS "Found OpenMP") else() @@ -281,8 +288,8 @@ if(OpenMP_FOUND) set(OPENMP_DLL VCOMP140) endif() if(OPENMP_DLL) - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DELAYLOAD:${OPENMP_DLL}D.dll") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DELAYLOAD:${OPENMP_DLL}.dll") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL}D.dll") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL}.dll") else() message(WARNING "Delay loading flag for OpenMP DLL is invalid.") endif() @@ -299,18 +306,15 @@ find_package(Eigen 3.1 REQUIRED) include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) # FLANN (required) -if(NOT PCL_SHARED_LIBS OR ((WIN32 AND NOT MINGW) AND NOT PCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32)) - set(FLANN_USE_STATIC ON) +find_package(FLANN 1.9.1 REQUIRED) +if(NOT (${FLANN_LIBRARY_TYPE} MATCHES ${PCL_FLANN_REQUIRED_TYPE}) AND NOT (${PCL_FLANN_REQUIRED_TYPE} MATCHES "DONTCARE")) + message(FATAL_ERROR "Flann was selected with ${PCL_FLANN_REQUIRED_TYPE} but found as ${FLANN_LIBRARY_TYPE}") endif() -find_package(FLANN 1.7.0 REQUIRED) -# libusb-1.0 +# libusb option(WITH_LIBUSB "Build USB RGBD-Camera drivers" TRUE) if(WITH_LIBUSB) - find_package(libusb-1.0) - if(LIBUSB_1_FOUND) - include_directories(SYSTEM "${LIBUSB_1_INCLUDE_DIR}") - endif() + find_package(libusb) endif() # Dependencies for different grabbers @@ -363,89 +367,44 @@ if(WITH_CUDA) include("${PCL_SOURCE_DIR}/cmake/pcl_find_cuda.cmake") endif() -option(WITH_QT "Build QT Front-End" TRUE) -if(WITH_QT) - find_package(Qt5 COMPONENTS Concurrent OpenGL Widgets QUIET) -endif() -# Find VTK +# Reset VTK_FOUND to off +set(VTK_FOUND OFF) +# Find VTK - VTK has to be found before Qt, otherwise it can overwrite Qt variables option(WITH_VTK "Build VTK-Visualizations" TRUE) -if(WITH_VTK AND NOT ANDROID) - set(PCL_VTK_COMPONENTS - vtkChartsCore - vtkCommonCore - vtkCommonDataModel - vtkCommonExecutionModel - vtkFiltersCore - vtkFiltersExtraction - vtkFiltersModeling - vtkImagingCore - vtkImagingSources - vtkInteractionStyle - vtkInteractionWidgets - vtkIOCore - vtkIOGeometry - vtkIOImage - vtkIOLegacy - vtkIOPLY - vtkRenderingAnnotation - vtkRenderingLOD - vtkViewsContext2D - ) - find_package(VTK COMPONENTS ${PCL_VTK_COMPONENTS}) - if(VTK_FOUND AND ("${VTK_VERSION}" VERSION_LESS 6.2)) - message(WARNING "The minimum required version of VTK is 6.2, but found ${VTK_VERSION}") - set(VTK_FOUND FALSE) +if(WITH_VTK) + if(ANDROID) + message(WARNING "VTK is not supported on Android.") + else() + include("${PCL_SOURCE_DIR}/cmake/pcl_find_vtk.cmake") endif() +endif() - if(VTK_FOUND) - if(NOT DEFINED VTK_RENDERING_BACKEND) - # On old VTK versions this variable does not exist. In this case it is - # safe to assume OpenGL backend - set(VTK_RENDERING_BACKEND "OpenGL") - endif() - list(APPEND PCL_VTK_COMPONENTS vtkRenderingContext${VTK_RENDERING_BACKEND}) - - if(WITH_QT) - if(";${VTK_MODULES_ENABLED};" MATCHES ";vtkGUISupportQt;" AND ";${VTK_MODULES_ENABLED};" MATCHES ";vtkRenderingQt;") - set(QVTK_FOUND ON) - list(APPEND PCL_VTK_COMPONENTS vtkRenderingQt vtkGUISupportQt) - else() - unset(QVTK_FOUND) - endif() +#VTK can depend on Qt and search for its required version, so search after so we can overwrite Qt5_FOUND if the version we require is not found. +option(WITH_QT "Build QT Front-End" TRUE) +if(WITH_QT) + find_package(Qt5 5.9.5 COMPONENTS Concurrent OpenGL Widgets) + set(QT_DISABLE_PRECATED_BEFORE_VAL "0x050900") + + if(Qt5_FOUND) + message(STATUS "Qt5 version: ${Qt5_VERSION}") + set(QT5_FOUND ${Qt5_FOUND}) + #Set Cmake Auto features to skip .hh files + if(POLICY CMP0100) + cmake_policy(SET CMP0100 OLD) endif() + + get_property(core_def TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_DEFINITIONS) + list(APPEND core_def "QT_DISABLE_DEPRECATED_BEFORE=${QT_DISABLE_PRECATED_BEFORE_VAL}") + set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_DEFINITIONS ${core_def}) - find_package(VTK COMPONENTS ${PCL_VTK_COMPONENTS}) - - message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}, rendering backend: ${VTK_RENDERING_BACKEND}") - if(PCL_SHARED_LIBS OR (NOT (PCL_SHARED_LIBS) AND NOT (VTK_BUILD_SHARED_LIBS))) - if(VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, libs: ${VTK_LIBRARIES}") - if(APPLE) - option(VTK_USE_COCOA "Use Cocoa for VTK render windows" ON) - mark_as_advanced(VTK_USE_COCOA) - endif() - if(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL") - set(VTK_RENDERING_BACKEND_OPENGL_VERSION "1") - message(DEPRECATION "The rendering backend OpenGL is deprecated and not available anymore since VTK 8.2." - "Please switch to the OpenGL2 backend instead, which is available since VTK 6.2." - "Support of the deprecated backend will be dropped with PCL 1.13.") - elseif(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL2") - set(VTK_RENDERING_BACKEND_OPENGL_VERSION "2") - endif() - else() - set(VTK_FOUND OFF) - message("Warning: You are to build PCL in STATIC but VTK is SHARED!") - message("Warning: VTK disabled!") - endif() + else() + message(STATUS "Qt5 is not found.") endif() else() - set(VTK_FOUND OFF) + set(Qt5_FOUND FALSE) endif() - #Find PCAP option(WITH_PCAP "pcap file capabilities in Velodyne HDL driver" TRUE) if(WITH_PCAP) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16e64b7a..c940ed3b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ restrictions: * [Discord Server](https://discord.gg/JFFMAXS) for live chat with other members of the PCL community and casual discussions - @@ -42,7 +42,7 @@ commits. **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge -into the project. Please read the [tutorial on writing a new PCL class](http://pointclouds.org/documentation/tutorials/writing_new_classes.php#writing-new-classes) if you want to contribute a +into the project. Please read the [tutorial on writing a new PCL class](https://pcl.readthedocs.io/projects/tutorials/en/latest/writing_new_classes.html) if you want to contribute a brand new feature. If you are new to Git, GitHub, or contributing to an open-source project, you @@ -55,7 +55,7 @@ may want to consult the [step-by-step guide on preparing and submitting a pull r Please use the following checklist to make sure that your contribution is well prepared for merging into PCL: -1. Source code adheres to the coding conventions described in [PCL Style Guide](http://pointclouds.org/documentation/advanced/pcl_style_guide.php). +1. Source code adheres to the coding conventions described in [PCL Style Guide](http://pcl.readthedocs.io/projects/advanced/en/latest/pcl_style_guide.html). But if you modify existing code, do not change/fix style in the lines that are not related to your contribution. @@ -114,40 +114,12 @@ of each `.h` and `.cpp` file: ```cpp /* - * Software License Agreement (BSD License) + * SPDX-License-Identifier: BSD-3-Clause * * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2014-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Copyright (c) 2014-, Open Perception Inc. * + * All rights reserved */ ``` diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 349ad7c4..a1283a81 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -101,20 +101,19 @@ macro(find_boost) endif() set(Boost_ADDITIONAL_VERSIONS "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@" - "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" - "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" - "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" - "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55") + "1.76.0" "1.76" "1.75.0" "1.75" + "1.74.0" "1.74" "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" + "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65") # Disable the config mode of find_package(Boost) set(Boost_NO_BOOST_CMAKE ON) - find_package(Boost 1.55.0 ${QUIET_} COMPONENTS @PCLCONFIG_AVAILABLE_BOOST_MODULES@) + find_package(Boost 1.65.0 ${QUIET_} COMPONENTS @PCLCONFIG_AVAILABLE_BOOST_MODULES@) set(BOOST_FOUND ${Boost_FOUND}) set(BOOST_INCLUDE_DIRS "${Boost_INCLUDE_DIR}") set(BOOST_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}") set(BOOST_LIBRARIES ${Boost_LIBRARIES}) if(WIN32 AND NOT MINGW) - set(BOOST_DEFINITIONS ${BOOST_DEFINITIONS} -DBOOST_ALL_NO_LIB) + string(APPEND BOOST_DEFINITIONS -DBOOST_ALL_NO_LIB) endif() endmacro() @@ -126,7 +125,6 @@ macro(find_eigen) get_filename_component(EIGEN_ROOT "@EIGEN_INCLUDE_DIRS@" ABSOLUTE) endif() find_package(Eigen 3.1) - set(EIGEN_DEFINITIONS ${EIGEN_DEFINITIONS}) endmacro() #remove this as soon as qhull is shipped with FindQhull.cmake @@ -255,17 +253,7 @@ macro(find_VTK) endmacro() macro(find_libusb) - if(NOT WIN32) - find_path(LIBUSB_1_INCLUDE_DIR - NAMES libusb-1.0/libusb.h - PATHS /usr/include /usr/local/include /opt/local/include /sw/include - PATH_SUFFIXES libusb-1.0) - - find_library(LIBUSB_1_LIBRARY - NAMES usb-1.0 - PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib) - find_package_handle_standard_args(libusb-1.0 LIBUSB_1_LIBRARY LIBUSB_1_INCLUDE_DIR) - endif() + find_package(libusb) endmacro() macro(find_glew) @@ -310,7 +298,7 @@ macro(find_external_library _component _lib _is_optional) find_rssdk2() elseif("${_lib}" STREQUAL "vtk") find_VTK() - elseif("${_lib}" STREQUAL "libusb-1.0") + elseif("${_lib}" STREQUAL "libusb") find_libusb() elseif("${_lib}" STREQUAL "glew") find_glew() @@ -396,6 +384,9 @@ file(TO_CMAKE_PATH "${PCL_DIR}" PCL_DIR) if(WIN32 AND NOT MINGW) # PCLConfig.cmake is installed to PCL_ROOT/cmake get_filename_component(PCL_ROOT "${PCL_DIR}" PATH) + if(EXISTS "${PCL_ROOT}/3rdParty") + set(PCL_ALL_IN_ONE_INSTALLER ON) + endif() else() # PCLConfig.cmake is installed to PCL_ROOT/share/pcl-x.y get_filename_component(PCL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) @@ -407,17 +398,11 @@ if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl # pcl_message("Found a PCL installation") set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}") set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@") - if(EXISTS "${PCL_ROOT}/3rdParty") - set(PCL_ALL_IN_ONE_INSTALLER ON) - endif() elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h") # Found a non-standard (likely ANDROID) PCL installation # pcl_message("Found a PCL installation") set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include") set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib") - if(EXISTS "${PCL_ROOT}/3rdParty") - set(PCL_ALL_IN_ONE_INSTALLER ON) - endif() elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h") # Found PCLConfig.cmake in a build tree of PCL # pcl_message("PCL found into a build tree.") @@ -529,6 +514,7 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) #pcl_message("No include directory found for pcl_${component}.") endif() + set(FPHSA_NAME_MISMATCHED 1) # Suppress warnings, see https://cmake.org/cmake/help/v3.17/module/FindPackageHandleStandardArgs.html # Skip find_library for header only modules list(FIND pcl_header_only_components ${component} _is_header_only) if(_is_header_only EQUAL -1) @@ -565,6 +551,7 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) find_package_handle_standard_args(PCL_${COMPONENT} DEFAULT_MSG PCL_${COMPONENT}_INCLUDE_DIR) endif() + unset(FPHSA_NAME_MISMATCHED) if(PCL_${COMPONENT}_FOUND) if(NOT "${PCL_${COMPONENT}_INCLUDE_DIRS}" STREQUAL "") diff --git a/README.md b/README.md index 9ae34aae..b8c83e4d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Release][release-image]][releases] [![License][license-image]][license] -[release-image]: https://img.shields.io/badge/release-1.11.1-green.svg?style=flat +[release-image]: https://img.shields.io/badge/release-1.12.0-green.svg?style=flat [releases]: https://github.com/PointCloudLibrary/pcl/releases [license-image]: https://img.shields.io/badge/license-BSD-green.svg?style=flat @@ -21,19 +21,22 @@ If you really need access to the old website, please use [the copy made by the i Continuous integration ---------------------- [ci-latest-build]: https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=9&branchName=master -[ci-ubuntu-16.04]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20GCC&jobName=Ubuntu&configuration=Ubuntu%2016.04%20GCC&label=Ubuntu%2016.04%20GCC -[ci-ubuntu-18.04]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20Clang&jobName=Ubuntu&configuration=Ubuntu%2018.04%20Clang&label=Ubuntu%2018.04%20Clang -[ci-ubuntu-20.04]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20GCC&jobName=Ubuntu&configuration=Ubuntu%2020.04%20GCC&label=Ubuntu%2020.04%20GCC -[ci-windows-x86]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20MSVC&jobName=Windows%20VS2017%20Build&configuration=Windows%20VS2017%20Build%20x86&label=Windows%20VS2017%20x86 -[ci-windows-x64]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20MSVC&jobName=Windows%20VS2017%20Build&configuration=Windows%20VS2017%20Build%20x64&label=Windows%20VS2017%20x64 +[ci-ubuntu-18.04]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20GCC&jobName=Ubuntu&configuration=Ubuntu%2018.04%20GCC&label=Ubuntu%2018.04%20GCC +[ci-ubuntu-20.04]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20Clang&jobName=Ubuntu&configuration=Ubuntu%2020.04%20Clang&label=Ubuntu%2020.04%20Clang +[ci-ubuntu-20.10]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20GCC&jobName=Ubuntu&configuration=Ubuntu%2020.10%20GCC&label=Ubuntu%2020.10%20GCC +[ci-windows-x86]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20MSVC&jobName=Windows%20Build&configuration=Windows%20Build%20x86&label=Windows%20VS2019%20x86 +[ci-windows-x64]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20MSVC&jobName=Windows%20Build&configuration=Windows%20Build%20x64&label=Windows%20VS2019%20x64 [ci-macos-10.14]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20Clang&jobName=macOS&configuration=macOS%20Mojave%2010.14&label=macOS%20Mojave%2010.14 [ci-macos-10.15]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/9?branchName=master&stageName=Build%20Clang&jobName=macOS&configuration=macOS%20Catalina%2010.15&label=macOS%20Catalina%2010.15 +[ci-docs]: https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/Documentation?branchName=master +[ci-latest-docs]: https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=14&branchName=master Build Platform | Status ------------------------ | ------------------------------------------------------------------------------------------------- | -Ubuntu | [![Status][ci-ubuntu-16.04]][ci-latest-build]
[![Status][ci-ubuntu-18.04]][ci-latest-build]
[![Status][ci-ubuntu-20.04]][ci-latest-build] | +Ubuntu | [![Status][ci-ubuntu-18.04]][ci-latest-build]
[![Status][ci-ubuntu-20.04]][ci-latest-build]
[![Status][ci-ubuntu-20.10]][ci-latest-build] | Windows | [![Status][ci-windows-x86]][ci-latest-build]
[![Status][ci-windows-x64]][ci-latest-build] | macOS | [![Status][ci-macos-10.14]][ci-latest-build]
[![Status][ci-macos-10.15]][ci-latest-build] | +Documentation | [![Status][ci-docs]][ci-latest-docs] | Community --------- @@ -97,3 +100,18 @@ for Q&A as well as support for troubleshooting, installation and debugging. Do remember to tag your questions with the tag `point-cloud-library`. * [Discord Server](https://discord.gg/JFFMAXS) for live chat with other members of the PCL community and casual discussions + +Citation +-------- +We encourage other researchers to cite PCL if they use PCL or its components for their work or baselines. The bibtex entry for the same is +``` +@InProceedings{Rusu_ICRA2011_PCL, + author = {Radu Bogdan Rusu and Steve Cousins}, + title = {{3D is here: Point Cloud Library (PCL)}}, + booktitle = {{IEEE International Conference on Robotics and Automation (ICRA)}}, + month = {May 9-13}, + year = {2011}, + address = {Shanghai, China}, + publisher = {IEEE} +} +``` diff --git a/apps/3d_rec_framework/CMakeLists.txt b/apps/3d_rec_framework/CMakeLists.txt index ec6c56d8..219c4def 100644 --- a/apps/3d_rec_framework/CMakeLists.txt +++ b/apps/3d_rec_framework/CMakeLists.txt @@ -1,25 +1,7 @@ set(SUBSUBSYS_NAME 3d_rec_framework) set(SUBSUBSYS_DESC "3D recognition framework") set(SUBSUBSYS_DEPS common geometry io filters sample_consensus segmentation visualization kdtree features surface octree registration keypoints tracking search recognition ml) - -# Find VTK -if(NOT VTK_FOUND) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not found.") -else() - set(DEFAULT TRUE) - set(REASON) - include("${VTK_USE_FILE}") -endif() - -# OpenNI found? -if(NOT WITH_OPENNI) - set(DEFAULT AUTO_OFF) - set(REASON "OpenNI was not found or was disabled by the user.") -elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) -endif() +set(SUBSUBSYS_EXT_DEPS vtk openni) # Default to not building for now if(${DEFAULT} STREQUAL "TRUE") @@ -27,7 +9,7 @@ if(${DEFAULT} STREQUAL "TRUE") endif() PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" ${DEFAULT} "${REASON}") -PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS} EXT_DEPS vtk openni) +PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS} EXT_DEPS ${SUBSUBSYS_EXT_DEPS}) if(NOT build) return() @@ -112,10 +94,6 @@ target_link_libraries("${LIB_NAME}" pcl_apps pcl_common pcl_io pcl_filters pcl_v if(WITH_OPENNI) target_link_libraries("${LIB_NAME}" ${OPENNI_LIBRARIES}) - if(NOT WIN32) - find_package(libusb-1.0 REQUIRED) - target_link_libraries("${LIB_NAME}" ${LIBUSB_1_LIBRARIES}) - endif() endif() PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h index 97583935..471f647f 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include #include @@ -133,7 +132,7 @@ public: for (std::size_t i = 0; i < cvfh_signatures.size(); i++) { pcl::PointCloud vfh_signature; - vfh_signature.points.resize(1); + vfh_signature.resize(1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) vfh_signature[0].histogram[d] = cvfh_signatures[i].histogram[d]; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h index 85e5c264..621702ae 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h @@ -162,7 +162,7 @@ public: for (const auto& point : cvfh_signatures.points) { pcl::PointCloud vfh_signature; - vfh_signature.points.resize(1); + vfh_signature.resize(1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) vfh_signature[0].histogram[d] = point.histogram[d]; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h index c4106401..efcda555 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include namespace pcl { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h index d78c4eec..c37229b9 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h @@ -77,7 +77,7 @@ private: using KeypointExtractor::input_; using KeypointExtractor::radius_; float sampling_density_; - std::shared_ptr>> neighborhood_indices_; + std::shared_ptr> neighborhood_indices_; std::shared_ptr>> neighborhood_dist_; void @@ -92,12 +92,12 @@ private: tree.reset(new pcl::search::KdTree(false)); tree->setInputCloud(input); - neighborhood_indices_.reset(new std::vector>); + neighborhood_indices_.reset(new std::vector); neighborhood_indices_->resize(keypoints_cloud->size()); neighborhood_dist_.reset(new std::vector>); neighborhood_dist_->resize(keypoints_cloud->size()); - filtered_keypoints.points.resize(keypoints_cloud->size()); + filtered_keypoints.resize(keypoints_cloud->size()); int good = 0; for (std::size_t i = 0; i < keypoints_cloud->size(); i++) { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h index 9fef4505..31664672 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace pcl { namespace rec_3d_framework { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h index 3b86d64a..51fbf34b 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace pcl { namespace rec_3d_framework { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h index b1a7f539..a8f49baa 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h @@ -30,9 +30,8 @@ class PreProcessorAndNormalEstimator { KdTreeInPtr tree = pcl::make_shared>(false); tree->setInputCloud(input); - std::vector nn_indices(9); + pcl::Indices nn_indices(9); std::vector nn_distances(9); - std::vector src_indices; float sum_distances = 0.0; std::vector avg_distances(input->size()); @@ -198,7 +197,7 @@ public: } if (j != static_cast(out->size())) { - PCL_ERROR("Contain nans..."); + PCL_ERROR("Contain nans...\n"); } out->points.resize(j); diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h index 8c3238dd..6e171361 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -81,9 +80,8 @@ public: void loadOrGenerate(std::string& dir, std::string& model_path, ModelT& model) { - std::stringstream pathmodel; - pathmodel << dir << "/" << model.class_ << "/" << model.id_; - bf::path trained_dir = pathmodel.str(); + const std::string pathmodel = dir + '/' + model.class_ + '/' + model.id_; + bf::path trained_dir = pathmodel; model.views_.reset(new std::vector::Ptr>); model.poses_.reset( @@ -95,7 +93,6 @@ public: if (bf::exists(trained_dir)) { // load views, poses and self-occlusions std::vector view_filenames; - int number_of_views = 0; for (const auto& dir_entry : bf::directory_iterator(trained_dir)) { // check if its a directory, then get models in it if (!(bf::is_directory(dir_entry))) { @@ -112,17 +109,14 @@ public: if (extension == "pcd" && strs_[0] == "view") { view_filenames.push_back((dir_entry.path().filename()).string()); - - number_of_views++; } } } for (const auto& view_filename : view_filenames) { - std::stringstream view_file; - view_file << pathmodel.str() << "/" << view_filename; + const std::string view_file = pathmodel + '/' + view_filename; typename pcl::PointCloud::Ptr cloud(new pcl::PointCloud()); - pcl::io::loadPCDFile(view_file.str(), *cloud); + pcl::io::loadPCDFile(view_file, *cloud); model.views_->push_back(cloud); @@ -135,19 +129,17 @@ public: boost::replace_all(file_replaced2, ".pcd", ".txt"); // read pose as well - std::stringstream pose_file; - pose_file << pathmodel.str() << "/" << file_replaced1; + const std::string pose_file = pathmodel + '/' + file_replaced1; Eigen::Matrix4f pose; - PersistenceUtils::readMatrixFromFile(pose_file.str(), pose); + PersistenceUtils::readMatrixFromFile(pose_file, pose); model.poses_->push_back(pose); // read entropy as well - std::stringstream entropy_file; - entropy_file << pathmodel.str() << "/" << file_replaced2; + const std::string entropy_file = pathmodel + '/' + file_replaced2; float entropy = 0; - PersistenceUtils::readFloatFromFile(entropy_file.str(), entropy); + PersistenceUtils::readFloatFromFile(entropy_file, entropy); model.self_occlusions_->push_back(entropy); } } @@ -201,26 +193,23 @@ public: model.self_occlusions_->push_back(entropies[i]); } - std::stringstream direc; - direc << dir << "/" << model.class_ << "/" << model.id_; + const std::string direc = dir + '/' + model.class_ + '/' + model.id_; this->createClassAndModelDirectories(dir, model.class_, model.id_); for (std::size_t i = 0; i < model.views_->size(); i++) { // save generated model for future use - std::stringstream path_view; - path_view << direc.str() << "/view_" << i << ".pcd"; - pcl::io::savePCDFileBinary(path_view.str(), *(model.views_->at(i))); + const std::string path_view = direc + "/view_" + std::to_string(i) + ".pcd"; + pcl::io::savePCDFileBinary(path_view, *(model.views_->at(i))); - std::stringstream path_pose; - path_pose << direc.str() << "/pose_" << i << ".txt"; + const std::string path_pose = direc + "/pose_" + std::to_string(i) + ".txt"; - pcl::rec_3d_framework::PersistenceUtils::writeMatrixToFile(path_pose.str(), + pcl::rec_3d_framework::PersistenceUtils::writeMatrixToFile(path_pose, model.poses_->at(i)); - std::stringstream path_entropy; - path_entropy << direc.str() << "/entropy_" << i << ".txt"; + const std::string path_entropy = + direc + "/entropy_" + std::to_string(i) + ".txt"; pcl::rec_3d_framework::PersistenceUtils::writeFloatToFile( - path_entropy.str(), model.self_occlusions_->at(i)); + path_entropy, model.self_occlusions_->at(i)); } loadOrGenerate(dir, model_path, model); diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h index 06319ec4..1699f85d 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include #include @@ -100,9 +100,8 @@ public: void loadOrGenerate(std::string& dir, std::string& model_path, ModelT& model) { - std::stringstream pathmodel; - pathmodel << dir << "/" << model.class_ << "/" << model.id_; - bf::path trained_dir = pathmodel.str(); + const std::string pathmodel = dir + '/' + model.class_ + '/' + model.id_; + const bf::path trained_dir = pathmodel; model.views_.reset(new std::vector::Ptr>); model.poses_.reset( @@ -112,7 +111,6 @@ public: if (bf::exists(trained_dir)) { // load views and poses std::vector view_filenames; - int number_of_views = 0; for (const auto& dir_entry : bf::directory_iterator(trained_dir)) { // check if its a directory, then get models in it if (!(bf::is_directory(*itr))) { @@ -129,7 +127,6 @@ public: if (extension == "pcd" && strs_[0] == "view") { view_filenames.push_back((dir_entry.path().filename()).string()); - number_of_views++; } } } @@ -138,10 +135,9 @@ public: poses_to_assemble_; for (std::size_t i = 0; i < view_filenames.size(); i++) { - std::stringstream view_file; - view_file << pathmodel.str() << "/" << view_filenames[i]; + const std::string view_file = pathmodel + '/' + view_filenames[i]; typename pcl::PointCloud::Ptr cloud(new pcl::PointCloud()); - pcl::io::loadPCDFile(view_file.str(), *cloud); + pcl::io::loadPCDFile(view_file, *cloud); model.views_->push_back(cloud); @@ -150,10 +146,9 @@ public: boost::replace_all(file_replaced1, ".pcd", ".txt"); // read pose as well - std::stringstream pose_file; - pose_file << pathmodel.str() << "/" << file_replaced1; + const std::string pose_file = pathmodel + '/' + file_replaced1; Eigen::Matrix4f pose; - PersistenceUtils::readMatrixFromFile(pose_file.str(), pose); + PersistenceUtils::readMatrixFromFile(pose_file, pose); if (pose_files_order_ != 0) { Eigen::Matrix4f pose_trans = pose.transpose(); @@ -175,8 +170,7 @@ public: else { // we just need to copy the views to the training directory - std::stringstream direc; - direc << dir << "/" << model.class_ << "/" << model.id_; + const std::string direc = dir + '/' + model.class_ + '/' << model.id_; createClassAndModelDirectories(dir, model.class_, model.id_); std::vector view_filenames; @@ -186,23 +180,20 @@ public: std::cout << view_filenames.size() << std::endl; for (std::size_t i = 0; i < view_filenames.size(); i++) { - std::stringstream view_file; - view_file << model_path << "/" << view_filenames[i]; + const std::string view_file = model_path + '/' + view_filenames[i]; typename pcl::PointCloud::Ptr cloud(new pcl::PointCloud()); - pcl::io::loadPCDFile(view_file.str(), *cloud); + pcl::io::loadPCDFile(view_file, *cloud); - std::cout << view_file.str() << std::endl; + std::cout << view_file << std::endl; - std::stringstream path_view; - path_view << direc.str() << "/view_" << i << ".pcd"; - pcl::io::savePCDFileBinary(path_view.str(), *cloud); + const std::string path_view = direc + "/view_" + std::to_string(i) + ".pcd"; + pcl::io::savePCDFileBinary(path_view, *cloud); - std::string file_replaced1(view_file.str()); - boost::replace_all(file_replaced1, view_prefix_, "pose"); - boost::replace_all(file_replaced1, ".pcd", ".txt"); + boost::replace_all(view_file, view_prefix_, "pose"); + boost::replace_all(view_file, ".pcd", ".txt"); Eigen::Matrix4f pose; - PersistenceUtils::readMatrixFromFile(file_replaced1, pose); + PersistenceUtils::readMatrixFromFile(view_file, pose); std::cout << pose << std::endl; @@ -213,10 +204,8 @@ public: std::cout << pose << std::endl; } - std::stringstream path_pose; - path_pose << direc.str() << "/pose_" << i << ".txt"; - pcl::rec_3d_framework::PersistenceUtils::writeMatrixToFile(path_pose.str(), - pose); + const std::string path_pose = direc + "/pose_" + std::to_string(i) + ".txt"; + pcl::rec_3d_framework::PersistenceUtils::writeMatrixToFile(path_pose, pose); } loadOrGenerate(dir, model_path, model); @@ -245,7 +234,7 @@ public: // check if its a directory, then get models in it if (bf::is_directory(dir_entry)) { std::string so_far = - rel_path_so_far + (dir_entry.path().filename()).string() + "/"; + rel_path_so_far + (dir_entry.path().filename()).string() + '/'; bf::path curr_path = dir_entry.path(); if (isleafDirectory(curr_path)) { @@ -289,14 +278,7 @@ public: m.id_ = strs[0]; } else { - std::stringstream ss; - for (int i = 0; i < (static_cast(strs.size()) - 1); i++) { - ss << strs[i]; - if (i != (static_cast(strs.size()) - 1)) - ss << "/"; - } - - m.class_ = ss.str(); + m.class_ = boost::algorithm::join(strs, '/'); m.id_ = strs[strs.size() - 1]; } @@ -305,10 +287,8 @@ public: // load views, poses and self-occlusions for those that exist // generate otherwise - std::stringstream model_path; - model_path << path_ << "/" << files[i]; - std::string path_model = model_path.str(); - loadOrGenerate(training_dir, path_model, m); + const std::string model_path = path_ + '/' + files[i]; + loadOrGenerate(training_dir, model_path, m); models_->push_back(m); } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h index a3f45ee4..91b4cd9b 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h @@ -8,9 +8,7 @@ #pragma once #include -#include #include -#include #include #include @@ -93,20 +91,9 @@ protected: std::string& id, std::string& classname) { - - std::vector strs; - boost::split(strs, filename, boost::is_any_of("/\\")); - std::string name = strs[strs.size() - 1]; - - std::stringstream ss; - for (int i = 0; i < (static_cast(strs.size()) - 1); i++) { - ss << strs[i]; - if (i != (static_cast(strs.size()) - 1)) - ss << "/"; - } - - classname = ss.str(); - id = name.substr(0, name.length() - 4); + const bf::path path = filename; + classname = path.parent_path().string() + '/'; + id = path.stem().string(); } void @@ -122,22 +109,7 @@ protected: std::string& class_str, std::string& id_str) { - std::vector strs; - boost::split(strs, class_str, boost::is_any_of("/\\")); - - std::stringstream ss; - ss << training_dir << "/"; - for (const auto& str : strs) { - ss << str << "/"; - bf::path trained_dir = ss.str(); - if (!bf::exists(trained_dir)) - bf::create_directory(trained_dir); - } - - ss << id_str; - bf::path trained_dir = ss.str(); - if (!bf::exists(trained_dir)) - bf::create_directory(trained_dir); + bf::create_directories(training_dir + '/' + class_str + '/' + id_str); } public: @@ -174,7 +146,7 @@ public: // check if its a directory, then get models in it if (bf::is_directory(dir_entry)) { std::string so_far = - rel_path_so_far + (dir_entry.path().filename()).string() + "/"; + rel_path_so_far + (dir_entry.path().filename()).string() + '/'; bf::path curr_path = dir_entry.path(); getModelsInDirectory(curr_path, so_far, relative_paths, ext); @@ -239,19 +211,13 @@ public: bool modelAlreadyTrained(ModelT m, std::string& base_dir, std::string& descr_name) { - std::stringstream dir; - dir << base_dir << "/" << m.class_ << "/" << m.id_ << "/" << descr_name; - bf::path desc_dir = dir.str(); - std::cout << dir.str() << std::endl; - return bf::exists(desc_dir); + return bf::exists(getModelDescriptorDir(m, base_dir, descr_name)); } std::string getModelDescriptorDir(ModelT m, std::string& base_dir, std::string& descr_name) { - std::stringstream dir; - dir << base_dir << "/" << m.class_ << "/" << m.id_ << "/" << descr_name; - return dir.str(); + return base_dir + '/' + m.class_ + '/' + m.id_ + '/' + descr_name; } void diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h index 981cc5d6..d6554df8 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h @@ -9,7 +9,6 @@ #include #include -#include #include @@ -34,7 +33,7 @@ public: classify() = 0; virtual void - setIndices(std::vector& indices) = 0; + setIndices(pcl::Indices& indices) = 0; virtual void setInputCloud(const PointInTPtr& cloud) = 0; @@ -92,7 +91,7 @@ protected: flann::Index* flann_index_; std::vector flann_models_; - std::vector indices_; + pcl::Indices indices_; // load features from disk and create flann structure void @@ -186,7 +185,7 @@ public: } void - setIndices(std::vector& indices) override + setIndices(pcl::Indices& indices) override { indices_ = indices; } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h index fb597bb1..ff3bde4e 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h @@ -95,7 +95,7 @@ protected: poses_cache_; std::map, Eigen::Vector3f> centroids_cache_; - std::vector indices_; + pcl::Indices indices_; // load features from disk and create flann structure void @@ -216,7 +216,7 @@ public: } void - setIndices(std::vector& indices) + setIndices(pcl::Indices& indices) { indices_ = indices; } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h index 82e9cc34..54c5076c 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h @@ -130,7 +130,7 @@ protected: poses_cache_; std::map, Eigen::Vector3f> centroids_cache_; - std::vector indices_; + pcl::Indices indices_; bool compute_scale_; @@ -295,7 +295,7 @@ public: } void - setIndices(std::vector& indices) + setIndices(pcl::Indices& indices) { indices_ = indices; } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp index ac54b86a..0592be86 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp @@ -181,30 +181,28 @@ pcl::rec_3d_framework::GlobalNNPipeline::initializ if (!bf::exists(desc_dir)) bf::create_directory(desc_dir); - std::stringstream path_view; - path_view << path << "/view_" << v << ".pcd"; - pcl::io::savePCDFileBinary(path_view.str(), *processed); - - std::stringstream path_pose; - path_pose << path << "/pose_" << v << ".txt"; - PersistenceUtils::writeMatrixToFile(path_pose.str(), - models->at(i).poses_->at(v)); - - std::stringstream path_entropy; - path_entropy << path << "/entropy_" << v << ".txt"; - PersistenceUtils::writeFloatToFile(path_entropy.str(), + const std::string path_view = path + "/view_" + std::to_string(v) + ".pcd"; + pcl::io::savePCDFileBinary(path_view, *processed); + + const std::string path_pose = path + "/pose_" + std::to_string(v) + ".txt"; + PersistenceUtils::writeMatrixToFile(path_pose, models->at(i).poses_->at(v)); + + const std::string path_entropy = + path + "/entropy_" + std::to_string(v) + ".txt"; + PersistenceUtils::writeFloatToFile(path_entropy, models->at(i).self_occlusions_->at(v)); // save signatures and centroids to disk for (std::size_t j = 0; j < signatures.size(); j++) { - std::stringstream path_centroid; - path_centroid << path << "/centroid_" << v << "_" << j << ".txt"; + const std::string path_centroid = path + "/centroid_" + std::to_string(v) + + "_" + std::to_string(j) + ".txt"; Eigen::Vector3f centroid(centroids[j][0], centroids[j][1], centroids[j][2]); - PersistenceUtils::writeCentroidToFile(path_centroid.str(), centroid); + PersistenceUtils::writeCentroidToFile(path_centroid, centroid); - std::stringstream path_descriptor; - path_descriptor << path << "/descriptor_" << v << "_" << j << ".pcd"; - pcl::io::savePCDFileBinary(path_descriptor.str(), signatures[j]); + const std::string path_descriptor = path + "/descriptor_" + + std::to_string(v) + "_" + + std::to_string(j) + ".pcd"; + pcl::io::savePCDFileBinary(path_descriptor, signatures[j]); } } } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index 5d5052a0..d6ca7cd4 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -34,11 +34,11 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer::getP } } - std::stringstream dir; - std::string path = source_->getModelDescriptorDir(model, training_dir_, descr_name_); - dir << path << "/pose_" << view_id << ".txt"; + const std::string path = + source_->getModelDescriptorDir(model, training_dir_, descr_name_); + const std::string dir = path + "/pose_" + std::to_string(view_id) + ".txt"; - PersistenceUtils::readMatrixFromFile(dir.str(), pose_matrix); + PersistenceUtils::readMatrixFromFile(dir, pose_matrix); } template