danieltobon43/pcl-docker

By danieltobon43

Updated almost 4 years ago

Point cloud library 1.12.1 (Not GPU) support - adapted for deployment in Alpine Linux 3.15

Image
1

610

danieltobon43/pcl-docker repository overview

Point Cloud Library 1.12.1 Alpine Linux

The Point Cloud Library is an open-source library of algorithms for point cloud processing tasks and 3D geometry processing. It is a standalone, large-scale, open project for 2D/3D image and point cloud processing. PCL is released under the terms of the BSD license, and thus free for commercial and research use.

Environment

PackageVersionDescription
VTK9.1.0VTK - The Visualization Toolkit
PCL1.12.1The Point Cloud Library (PCL)
Eigen3.7.7Eigen is a library of template headers for linear algebra
Flann1.9.1Fast Library for Approximate Nearest Neighbors
Boost1.77.0Provides support for linear algebra, pseudorandom number generation, multithreading
OpenGL21.2.6Programming interface for rendering 2D and 3D vector graphics.

Docker multi-stage graph generated with: dockerfilegraph

The idea is that the docker image will contain all the required software and library dependencies to run a PCL application. This image is a lightweight version and is not intended for development (there is no CMake, g++, compiler).

Note

Not all PCL modules were compiled --> see Dockerfile at the bottom. For a full pcl-docker-alpine image see tag: 1.12.1-alpine3.15-All

Compiled Modules

PackageDescription
BUILD_2dNeed it for pcl features
BUILD_geometrycontains computational geometry data structures
BUILD_visualizationvisualize the results of algorithms operating on 3D point cloud data
BUILD_iocontains classes and functions for reading and writing point cloud data
BUILD_commoncontains the common data structures and methods used by the majority of PCL libraries
BUILD_kdtreeprovides the kd-tree data-structure, using FLANN
BUILD_octreeprovides efficient methods for creating a hierarchical tree data structure from point cloud data
BUILD_sample_consensusholds SAmple Consensus (SAC) methods like RANSAC
BUILD_searchprovides methods for searching for nearest neighbors

Docker image

You can either choose to build the image by yourself or pull it from the docker hub

Pull from docker-hub (Option A)
docker pull danieltobon43/pcl-docker:1.12.1-alpine3.15
Build it for yourself (Option B)

Build the image with Dockerfile. You can pass --build-arg PCL_VERSION="your-version" to chose PCL version in the build command below.

time docker build -f Dockerfile -t pcl-docker:1.12.1-alpine3.15 .

Start the container with

docker run --rm -it \
           --name="pcl-container" \
           pcl-docker:1.12.1-alpine3.15

Dockerfile

# ============================
# Stage: base image
# ============================
# syntax=docker/dockerfile:1
ARG PCL_VERSION="1.12.1"
FROM alpine:3.15 AS pcl-dependencies
RUN apk add --no-cache boost-dev vtk vtk-dev eigen-dev mesa-dev mesa-dri-swrast mesa-gl \
    flann-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing

# ============================
# Stage: build pcl
# ============================
FROM pcl-dependencies AS build-pcl

RUN apk add --no-cache wget cmake make g++

# Download point cloud library source code once
ARG PCL_VERSION
RUN cd /tmp && wget https://github.com/PointCloudLibrary/pcl/archive/pcl-${PCL_VERSION}.tar.gz \
    && tar -xf pcl-${PCL_VERSION}.tar.gz

# PCL build modules (be aware that some modules depend from another ones)
ENV BUILD_MODULES   -DBUILD_2d=ON \
                    -DBUILD_CUDA=OFF \
                    -DBUILD_GPU=OFF \
                    -DBUILD_apps=OFF \
                    -DBUILD_benchmarks=OFF \
                    -DBUILD_common=ON \
                    -DBUILD_examples=OFF \
                    -DBUILD_features=OFF \
                    -DBUILD_filters=ON \
                    -DBUILD_geometry=ON \
                    -DBUILD_global_tests=OFF \
                    -DBUILD_io=ON \
                    -DBUILD_kdtree=ON \
                    -DBUILD_keypoints=OFF \
                    -DBUILD_ml=OFF \
                    -DBUILD_octree=ON \
                    -DBUILD_outofcore=OFF \
                    -DBUILD_people=OFF \
                    -DBUILD_recognition=OFF \
                    -DBUILD_registration=OFF \
                    -DBUILD_sample_consensus=ON \
                    -DBUILD_search=ON \
                    -DBUILD_segmentation=OFF \
                    -DBUILD_simulation=OFF \
                    -DBUILD_stereo=OFF \
                    -DBUILD_surface=OFF \
                    -DBUILD_tools=OFF \
                    -DBUILD_tracking=OFF \
                    -DBUILD_visualization=ON

# Install pcl at /tmp/pcl-pcl-${PCL_VERSION}/install
ENV CMAKE_CONFIG -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pcl-pcl-${PCL_VERSION}/install \
                 -DCMAKE_BUILD_TYPE=Release

# Set flags support
ENV WITH_CONFIG -DWITH_CUDA=OFF \
                -DWITH_DAVIDSDK=OFF \
                -DWITH_DOCS=OFF \
                -DWITH_DSSDK=OFF \
                -DWITH_ENSENSO=OFF \
                -DWITH_LIBUSB=OFF \
                -DWITH_OPENGL=ON \
                -DWITH_OPENMP=ON \
                -DWITH_OPENNI=OFF \
                -DWITH_OPENNI2=OFF \
                -DWITH_PCAP=OFF \
                -DWITH_PNG=OFF \
                -DWITH_QHULL=OFF \
                -DWITH_QT=NO \
                -DWITH_RSSDK=OFF \
                -DWITH_RSSDK2=OFF \
                -DWITH_VTK=ON

# Set vtk backend rendering
ARG VTK_CONFIG -DVTK_RENDERING_BACKEND=OpenGL2

# Compile pcl
RUN cd /tmp/pcl-pcl-${PCL_VERSION} \
    && mkdir build install && cd build \
    && cmake ${BUILD_MODULES} ${CMAKE_CONFIG} ${WITH_CONFIG} ../ \
    && make -j$(nproc) \
    && make install

# Unset ENV variables
ENV BUILD_MODULES=
ENV CMAKE_CONFIG=
ENV WITH_CONFIG=

# ============================
# Stage: runtime
# ============================
FROM pcl-dependencies as runtime
ARG PCL_VERSION
COPY --from=build-pcl /tmp/pcl-pcl-${PCL_VERSION}/install /usr

PCL images tags

ImageVersionDescriptionSize (GB)
pcl-docker1.12.1-alpine3.15Lightweight image of PCL with visualization module1.27
pcl-docker1.12.1-alpine3.15-devLightweight image of PCL with visualization module + dev tools1.61
pcl-docker1.12.1-alpine3.15-AllFull image of PCL with all modules1.43
pcl-docker1.12.1-alpine3.15-All-devFull image of PCL with all modules + dev tools1.67
pcl-docker1.12.1-alpine3.15-All-GA-v1Full image of PCL with all modules Github Action V11.67
pcl-docker1.12.1-alpine3.15-All-GA-v2-testingFull image of PCL with all modules Github Action V2 - testing branch1.67
PCL Dockerfile Full Compiled Image (dev version)
# syntax = docker/dockerfile:1.3
FROM alpine:3.15 AS pcl-dependencies
RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache boost-dev vtk vtk-dev \
    qhull qhull-dev qhull-static qt5-qtbase-dev qt5-qttools-dev eigen-dev \
    mesa mesa-dev mesa-dri-swrast mesa-gl mesa-glapi mesa-osmesa mesa-dri-classic \
    freeglut freeglut-dev clang clang-dev xorg-server\
    flann-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing


FROM pcl-dependencies AS build-pcl

RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache wget cmake make g++

# Download point cloud library source code once
ARG PCL_VERSION="1.12.1"
RUN wget https://github.com/PointCloudLibrary/pcl/archive/pcl-${PCL_VERSION}.tar.gz --directory-prefix=/tmp \
    && tar -xf /tmp/pcl-${PCL_VERSION}.tar.gz -C /tmp

# PCL build modules (be aware that some modules depend from another ones)
ENV BUILD_COMMANDS -DBUILD_2d=ON \
    -DBUILD_CUDA=OFF \
    -DBUILD_GPU=OFF \
    -DBUILD_apps=ON \
    -DBUILD_benchmarks=OFF \
    -DBUILD_common=ON \
    -DBUILD_examples=OFF \
    -DBUILD_features=ON \
    -DBUILD_filters=ON \
    -DBUILD_geometry=ON \
    -DBUILD_global_tests=OFF \
    -DBUILD_io=ON \
    -DBUILD_kdtree=ON \
    -DBUILD_keypoints=ON \
    -DBUILD_ml=ON \
    -DBUILD_octree=ON \
    -DBUILD_outofcore=ON \
    -DBUILD_people=ON \
    -DBUILD_recognition=ON \
    -DBUILD_registration=ON \
    -DBUILD_sample_consensus=ON \
    -DBUILD_search=ON \
    -DBUILD_segmentation=ON \
    -DBUILD_simulation=ON \
    -DBUILD_stereo=ON \
    -DBUILD_surface=ON \
    -DBUILD_tools=ON \
    -DBUILD_tracking=ON \
    -DBUILD_visualization=ON \
    # CMAKE CONFIG
    -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pcl-pcl-${PCL_VERSION}/install \
    -DCMAKE_BUILD_TYPE=Release \
    # WITH_CONFIG
    -DWITH_CUDA=OFF \
    -DWITH_DAVIDSDK=OFF \
    -DWITH_DOCS=OFF \
    -DWITH_DSSDK=OFF \
    -DWITH_ENSENSO=OFF \
    -DWITH_LIBUSB=OFF \
    -DWITH_OPENGL=ON \
    -DWITH_OPENMP=ON \
    -DWITH_OPENNI=OFF \
    -DWITH_OPENNI2=OFF \
    -DWITH_PCAP=OFF \
    -DWITH_PNG=ON \
    -DWITH_QHULL=ON \
    -DWITH_QT=ON \
    -DWITH_RSSDK=OFF \
    -DWITH_RSSDK2=OFF \
    -DWITH_VTK=ON

# Compile pcl
RUN cd /tmp/pcl-pcl-${PCL_VERSION} \
    && mkdir build install && cd build \
    && cmake ${BUILD_COMMANDS} -DVTK_RENDERING_BACKEND=OpenGL2 ../ \
    && make -j$(nproc) \
    && make install

# Unset ENV variables
ENV BUILD_COMMANDS=

FROM pcl-dependencies as runtime
COPY --from=build-pcl /tmp/pcl-pcl-1.12.1/install /usr

FROM pcl-dependencies as dev
COPY --from=build-pcl /tmp/pcl-pcl-1.12.1/install /usr
RUN apk add --no-cache cmake build-base gdb zsh git sudo clang nano \
    lcov --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
ARG USERNAME=pcluser
RUN adduser --gecos "pcluser" \
    --disabled-password \
    --shell /bin/zsh \
    --uid 1000 \
    ${USERNAME} && \
    echo "$USERNAME:1234" | chpasswd && \
    echo "$USERNAME ALL=(ALL) ALL" > /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME && \
    # creates a group: docker with gid:1001
    addgroup --gid 1001 docker && \
    # add user:pcluser to docker,pcluser group
    addgroup ${USERNAME} docker
LABEL version="1.0" maintainer="Daniel T <email>" \
    description="Point Cloud Library Full Compiled v1.12.1 - Alpine Linux 3.15"
USER $USERNAME
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true && \
    wget https://gist.githubusercontent.com/danielTobon43/9fdbaa726a2d239b735a18c8e67d706e/raw/496deee02afc530f3b49537da04df3dbab39828d/robbyrussell.zsh-theme \
    -O /home/$USERNAME/.oh-my-zsh/themes/robbyrussell.zsh-theme && \
    echo "unset zle_bracketed_paste" >> /home/$USERNAME/.zshrc && unset DEBIAN_FRONTEND
WORKDIR /home/$USERNAME
CMD [ "zsh" ]

Build output

The C compiler identification is GNU 10.3.1
#13 1.455 -- The CXX compiler identification is GNU 10.3.1
#13 1.471 -- Detecting C compiler ABI info
#13 1.588 -- Detecting C compiler ABI info - done
#13 1.607 -- Check for working C compiler: /usr/bin/cc - skipped
#13 1.607 -- Detecting C compile features
#13 1.608 -- Detecting C compile features - done
#13 1.614 -- Detecting CXX compiler ABI info
#13 1.687 -- Detecting CXX compiler ABI info - done
#13 1.702 -- Check for working CXX compiler: /usr/bin/c++ - skipped
#13 1.703 -- Detecting CXX compile features
#13 1.704 -- Detecting CXX compile features - done
#13 1.741 -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0") 
#13 1.867 -- Found ClangFormat: /usr/bin/clang-format (found suitable version "12.0.1", minimum required is "10") 
#13 1.867 -- Adding target 'format'
#13 1.870 -- Performing Test HAVE_MARCH
#13 1.971 -- Performing Test HAVE_MARCH - Success
#13 1.972 -- Performing Test HAVE_MM_MALLOC
#13 2.062 -- Performing Test HAVE_MM_MALLOC - Success
#13 2.063 -- Performing Test HAVE_POSIX_MEMALIGN
#13 2.147 -- Performing Test HAVE_POSIX_MEMALIGN - Success
#13 2.148 -- Performing Test HAVE_SSE4_2_EXTENSIONS
#13 2.300 -- Performing Test HAVE_SSE4_2_EXTENSIONS - Success
#13 2.300 -- Using CPU native flags for SSE optimization: -msse4.2 -mfpmath=sse -march=native
#13 2.302 -- Performing Test HAVE_AVX2
#13 2.872 -- Performing Test HAVE_AVX2 - Failed
#13 2.872 -- Performing Test HAVE_AVX
#13 3.424 -- Performing Test HAVE_AVX - Failed
#13 3.685 -- Found OpenMP_C: -fopenmp (found version "4.5") 
#13 3.780 -- Found OpenMP_CXX: -fopenmp (found version "4.5") 
#13 3.781 -- Found OpenMP: TRUE (found version "4.5") found components: C CXX 
#13 3.781 -- Found OpenMP, spec date 201511
#13 3.783 -- Looking for pthread.h
#13 3.856 -- Looking for pthread.h - found
#13 3.856 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
#13 3.925 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
#13 3.928 -- Found Threads: TRUE  
#13 3.934 -- Checking for module 'eigen3'
#13 3.944 --   Found eigen3, version 3.4.0
#13 3.963 -- Found Eigen: /usr/include/eigen3 (Required is at least version "3.1") 
#13 3.963 -- Eigen found (include: /usr/include/eigen3, version: 3.4.0)
#13 3.977 -- Checking for module 'flann>=1.9.1'
#13 3.995 --   Found flann, version 1.9.1
#13 4.041 -- Found FLANN: /usr/lib/libflann_cpp.so (Required is at least version "1.9.1") 
#13 4.042 -- FLANN found (include: /usr/include, lib: /usr/lib/libflann_cpp.so)
#13 4.043 -- Checking for module 'metslib'
#13 4.077 --   Package 'metslib', required by 'virtual:world', not found
#13 4.101 -- Found ZLIB: /lib/libz.so (found version "1.2.12") 
#13 4.121 -- Found PNG: /usr/lib/libpng.so (found version "1.6.37") 
#13 4.124 -- Found Qhull version 8.0.2
#13 4.177 -- Found OpenGL: /usr/lib/libGL.so  found components: OpenGL missing components: GLX
#13 4.344 -- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
#13 4.356 -- Found HDF5: /usr/lib/libhdf5.so (found version "1.12.2") found components: C HL 
#13 4.361 -- Found NetCDF: /usr/include (found version "4.8.1") 
#13 4.457 -- Found X11: /usr/include   
#13 4.458 -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
#13 4.552 -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
#13 4.552 -- Looking for gethostbyname
#13 4.622 -- Looking for gethostbyname - found
#13 4.622 -- Looking for connect
#13 4.726 -- Looking for connect - found
#13 4.726 -- Looking for remove
#13 4.817 -- Looking for remove - found
#13 4.818 -- Looking for shmat
#13 4.885 -- Looking for shmat - found
#13 4.885 -- Looking for IceConnectionNumber in ICE
#13 4.970 -- Looking for IceConnectionNumber in ICE - found
#13 5.021 -- VTK version: 9.1.0
#13 5.021 -- VTK rendering backend: OpenGL2
#13 5.021 -- VTK Qt support: NOTFOUND
#13 5.021 -- VTK libs: VTK::WrappingTools;VTK::ViewsInfovis;VTK::CommonColor;VTK::ViewsContext2D;VTK::loguru;VTK::TestingRendering;VTK::TestingCore;VTK::vtksys;VTK::RenderingVolumeOpenGL2;VTK::glew;VTK::opengl;VTK::RenderingLabel;VTK::octree;VTK::RenderingLOD;VTK::RenderingImage;VTK::RenderingContextOpenGL2;VTK::IOVeraOut;VTK::hdf5;VTK::IOTecplotTable;VTK::IOSegY;VTK::IOParallelXML;VTK::IOPLY;VTK::IOOggTheora;VTK::theora;VTK::ogg;VTK::IONetCDF;VTK::netcdf;VTK::IOMotionFX;VTK::pegtl;VTK::IOParallel;VTK::jsoncpp;VTK::IOMINC;VTK::IOLSDyna;VTK::IOInfovis;VTK::libxml2;VTK::zlib;VTK::IOImport;VTK::IOIOSS;VTK::ioss;VTK::exodusII;VTK::cgns;VTK::IOHDF;VTK::IOVideo;VTK::IOMovie;VTK::IOExportPDF;VTK::libharu;VTK::IOExportGL2PS;VTK::RenderingGL2PSOpenGL2;VTK::gl2ps;VTK::png;VTK::IOExport;VTK::RenderingVtkJS;VTK::IOGeometry;VTK::RenderingSceneGraph;VTK::IOExodus;VTK::IOEnSight;VTK::IOCityGML;VTK::pugixml;VTK::IOChemistry;VTK::IOCONVERGECFD;VTK::IOCGNSReader;VTK::IOAsynchronous;VTK::IOAMR;VTK::InteractionImage;VTK::ImagingStencil;VTK::ImagingStatistics;VTK::ImagingMorphological;VTK::ImagingMath;VTK::ImagingFourier;VTK::IOSQL;VTK::sqlite;VTK::GeovisCore;VTK::libproj;VTK::InfovisLayout;VTK::ViewsCore;VTK::InteractionWidgets;VTK::RenderingVolume;VTK::RenderingAnnotation;VTK::ImagingHybrid;VTK::ImagingColor;VTK::InteractionStyle;VTK::FiltersTopology;VTK::FiltersSelection;VTK::FiltersSMP;VTK::FiltersProgrammable;VTK::FiltersPoints;VTK::FiltersVerdict;VTK::verdict;VTK::FiltersParallelImaging;VTK::FiltersImaging;VTK::ImagingGeneral;VTK::FiltersHyperTree;VTK::FiltersGeneric;VTK::FiltersFlowPaths;VTK::eigen;VTK::FiltersAMR;VTK::FiltersParallel;VTK::FiltersTexture;VTK::FiltersModeling;VTK::FiltersHybrid;VTK::DomainsChemistryOpenGL2;VTK::RenderingOpenGL2;VTK::RenderingUI;VTK::DomainsChemistry;VTK::ChartsCore;VTK::InfovisCore;VTK::FiltersExtraction;VTK::ParallelDIY;VTK::diy2;VTK::IOXML;VTK::IOXMLParser;VTK::expat;VTK::ParallelCore;VTK::IOLegacy;VTK::IOCore;VTK::doubleconversion;VTK::lz4;VTK::lzma;VTK::utf8;VTK::FiltersStatistics;VTK::ImagingSources;VTK::IOImage;VTK::DICOMParser;VTK::jpeg;VTK::metaio;VTK::tiff;VTK::RenderingContext2D;VTK::RenderingFreeType;VTK::freetype;VTK::kwiml;VTK::RenderingCore;VTK::FiltersSources;VTK::ImagingCore;VTK::FiltersGeometry;VTK::FiltersGeneral;VTK::fmt;VTK::CommonComputationalGeometry;VTK::FiltersCore;VTK::CommonExecutionModel;VTK::CommonDataModel;VTK::CommonSystem;VTK::CommonMisc;VTK::exprtk;VTK::CommonTransforms;VTK::CommonMath;VTK::kissfft;VTK::CommonCore
#13 5.047 -- Qt version: 5.15.3
#13 5.140 -- Found Boost: /usr/lib/cmake/Boost-1.77.0/BoostConfig.cmake (found suitable version "1.77.0", minimum required is "1.65.0") found components: filesystem date_time iostreams system 
#13 5.316 -- Found OpenGL: /usr/lib/libGL.so   
#13 5.319 -- Found GLEW: /usr/include  
#13 5.325 -- Found GLUT: /usr/lib/libglut.so  
#13 5.365 -- DOXYGEN_FOUND 
#13 5.365 -- HTML_HELP_COMPILER 
#13 5.379 -- PCL build with following flags:
#13 5.379 --  -Wabi=11 -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion -msse4.2 -mfpmath=sse -march=native  -fopenmp
#13 5.379 -- The following subsystems will be built:
#13 5.379 --   common
#13 5.379 --   kdtree
#13 5.380 --   octree
#13 5.380 --   search
#13 5.380 --   sample_consensus
#13 5.380 --   filters
#13 5.380 --   2d
#13 5.380 --   geometry
#13 5.380 --   io
#13 5.380 --   features
#13 5.380 --   ml
#13 5.380 --   segmentation
#13 5.380 --   visualization
#13 5.380 --   surface
#13 5.380 --   registration
#13 5.380 --   keypoints
#13 5.381 --   tracking
#13 5.381 --   recognition
#13 5.381 --   stereo
#13 5.381 --   apps
#13 5.381        not building: 
#13 5.381        |_ 3d_rec_framework: Disabled by default
#13 5.381        |_ cloud_composer: Cloud composer requires QVTK
#13 5.381        |_ in_hand_scanner: Disabled by default
#13 5.381        |_ modeler: VTK was not built with Qt support.
#13 5.381        |_ point_cloud_editor: Disabled by default
#13 5.382 --   outofcore
#13 5.382 --   people
#13 5.382 --   simulation
#13 5.382 --   tools
#13 5.382 -- The following subsystems will not be built:
#13 5.384 --   benchmarks: Disabled by default
#13 5.384 --   examples: Code examples are disabled by default.
#13 5.384 --   global_tests: Disabled by default
#13 5.389 -- Configuring done
#13 6.616 -- Generating done
#13 6.649 -- Build files have been written to: /tmp/pcl-pcl-1.12.1/build

Note:

  • VTK-9.1 Linux Alpine package is not compiled with QT support.
  • mesa-gl Linux Alpine package is not compiled with GLX support.

Tag summary

Content type

Image

Digest

Size

523.8 MB

Last updated

almost 4 years ago

Requires Docker Desktop 4.37.1 or later.