diff --git a/Dockerfile b/Dockerfile index 2b0f51c..c4b898d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,49 +20,44 @@ RUN if $build_dependences ; then \ libswscale-dev libavdevice-dev \ libdc1394-22-dev libraw1394-dev \ libjpeg-dev libtiff5-dev \ - libopenexr-dev \ + libopenexr-dev libeigen3-dev \ qemu gcc-aarch64-linux-gnu \ libboost-all-dev libpcap-dev libssl-dev g++ ;\ - python3 -mpip install numpy pyopengl Pillow pybind11 pandas ; \ ldconfig ;\ - rm -rf /var/lib/apt/lists/* ;\ + rm -rf /var/lib/apt/lists/* && apt-get clear ;\ + python3 -mpip install numpy pyopengl Pillow pybind11 pandas ; \ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1;\ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2;fi - - -RUN mkdir /slampy/program + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2;\ + python3 -mpip install poetry setuptools ; \ + mkdir /slampy/program; fi # Pangolin installation ARG Pangolin_Path='/slampy/program/Pangolin' ARG build_dependences=true -RUN mkdir $Pangolin_Path RUN if $build_dependences ; then \ - git clone https://github.com/stevenlovegrove/Pangolin.git $Pangolin_Path ; \ - fi + mkdir $Pangolin_Path && \ + git clone https://github.com/stevenlovegrove/Pangolin.git $Pangolin_Path && \ + cd $Pangolin_Path && \ + mkdir $Pangolin_Path/build && \ + cd build && \ + cmake .. && \ + make -j$(nproc) &&\ + make install ; fi -RUN mkdir $Pangolin_Path/build -WORKDIR $Pangolin_Path/build -RUN if $build_dependences ; then \ - cd $Pangolin_Path/build ;\ - cmake $Pangolin_Path ;\ - make -j7; \ - make install; fi #Eigen installation ARG Eigen_Path='/slampy/program/Eigen' ARG build_dependences=true -RUN mkdir $Eigen_Path -RUN if $build_dependences ; then \ - git clone https://gitlab.com/libeigen/eigen.git $Eigen_Path ; fi -RUN mkdir $Eigen_Path/build -WORKDIR $Eigen_Path/build RUN if $build_dependences ; then \ - cd $Eigen_Path/build ;\ - cmake $Eigen_Path ;\ - make -j7; \ + mkdir $Eigen_Path && \ + git clone https://gitlab.com/libeigen/eigen.git $Eigen_Path && \ + mkdir $Eigen_Path/build && \ + cd $Eigen_Path/build &&\ + cmake $Eigen_Path &&\ + make -j$(nproc) && \ make install; fi # OpenCV installation @@ -70,24 +65,22 @@ ARG opencv_Path='/slampy/program/opencv-3.4.11' ARG opencv_contrib_Path='/slampy/program/opencv_contrib-3.4.11' ARG build_dependences=true -RUN mkdir $opencv_Path -RUN if $build_dependences ; then \ - wget https://github.com/opencv/opencv/archive/3.4.11.zip ; \ - unzip 3.4.11.zip -d /slampy/program ;\ - rm 3.4.11.zip; \ - wget https://github.com/opencv/opencv_contrib/archive/3.4.11.zip ;\ - unzip 3.4.11.zip -d /slampy/program ;\ - rm 3.4.11.zip; fi -RUN cd $opencv_Path -RUN mkdir $opencv_Path/build - -WORKDIR $opencv_Path/build RUN if $build_dependences ; then \ + mkdir $opencv_Path &&\ + wget https://github.com/opencv/opencv/archive/3.4.11.zip && \ + unzip 3.4.11.zip -d /slampy/program &&\ + rm 3.4.11.zip && \ + wget https://github.com/opencv/opencv_contrib/archive/3.4.11.zip && \ + unzip 3.4.11.zip -d /slampy/program && \ + rm 3.4.11.zip && \ + cd $opencv_Path && \ + mkdir $opencv_Path/build &&\ + cd $opencv_Path/build &&\ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local \ - OPENCV_EXTRA_MODULES_PATH=$opencv_contrib_Path .. ; \ - make -j7 ;\ - make install ; \ - pip3 install --upgrade pip ;\ + OPENCV_EXTRA_MODULES_PATH=$opencv_contrib_Path .. && \ + make -j$(nproc) &&\ + make install && \ + pip3 install --upgrade pip &&\ python3 -mpip install opencv-contrib-python==3.4.11.45; fi @@ -95,19 +88,13 @@ RUN if $build_dependences ; then \ ARG Orb_Slam2_Path='/slampy/program/OrbSlam2' ARG build_orbslam2=true -RUN mkdir $Orb_Slam2_Path -RUN if $build_orbslam2 ; then \ - git clone https://github.com/GiordanoLaminetti/ORB_SLAM2 $Orb_Slam2_Path; fi - -RUN mkdir $Orb_Slam2_Path/build -WORKDIR $Orb_Slam2_Path - -RUN if $build_orbslam2 ; then \ - ./build.sh 2>/dev/null; \ - cd $Orb_Slam2_Path/build; fi - -WORKDIR $Orb_Slam2_Path/build RUN if $build_orbslam2 ; then \ + mkdir -p $Orb_Slam2_Path && \ + git clone https://github.com/GiordanoLaminetti/ORB_SLAM2 $Orb_Slam2_Path && \ + mkdir $Orb_Slam2_Path/build && \ + cd $Orb_Slam2_Path &&\ + ./build.sh 2>/dev/null && \ + cd $Orb_Slam2_Path/build && \ make install ; fi @@ -115,17 +102,13 @@ RUN if $build_orbslam2 ; then \ ARG Orb_Slam3_Path='/slampy/program/OrbSlam3' ARG build_orbslam3=true -RUN mkdir $Orb_Slam3_Path -RUN if $build_orbslam3 ; then \ - git clone https://github.com/GiordanoLaminetti/ORB_SLAM3 $Orb_Slam3_Path; fi -RUN mkdir $Orb_Slam3_Path/build - -WORKDIR $Orb_Slam3_Path -RUN if $build_orbslam3 ; then \ - ./build.sh 2>/dev/null ; fi - -WORKDIR $Orb_Slam3_Path/build RUN if $build_orbslam3 ; then \ + mkdir -p $Orb_Slam3_Path && \ + git clone https://github.com/GiordanoLaminetti/ORB_SLAM3 $Orb_Slam3_Path && \ + mkdir $Orb_Slam3_Path/build && \ + cd $Orb_Slam3_Path &&\ + ./build.sh 2>/dev/null && \ + cd $Orb_Slam3_Path/build &&\ make install; fi @@ -135,22 +118,20 @@ ARG build_orbslam2=true RUN if [ ! -L "/usr/lib/x86_64-linux-gnu/libboost_python-py35.so" ]; then \ ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py36.so \ - /usr/lib/x86_64-linux-gnu/libboost_python-py35.so ; fi -RUN apt-get update ; apt-get -y install libeigen3-dev -RUN if [ ! -L "/usr/local/include/Eigen" ]; then\ + /usr/lib/x86_64-linux-gnu/libboost_python-py35.so ; fi ;\ + if [ ! -L "/usr/local/include/Eigen" ]; then\ ln -s /usr/include/eigen3/Eigen /usr/local/include/Eigen ; fi -RUN mkdir $Orb_Slam2_PB_Path -RUN if $build_orbslam2 ; then \ - git clone https://github.com/GiordanoLaminetti/ORB_SLAM2-PythonBindings.git \ - $Orb_Slam2_PB_Path ; fi - -RUN mkdir $Orb_Slam2_PB_Path/build -WORKDIR $Orb_Slam2_PB_Path/build RUN if $build_orbslam2 ; then \ - cmake .. ;\ - make -j7 ;\ - make install ;\ + mkdir -p $Orb_Slam2_PB_Path && \ + /usr/bin/python3.6 -m pip install numpy && \ + git clone https://github.com/GiordanoLaminetti/ORB_SLAM2-PythonBindings.git \ + $Orb_Slam2_PB_Path && \ + mkdir $Orb_Slam2_PB_Path/build && \ + cd $Orb_Slam2_PB_Path/build && \ + cmake $Orb_Slam2_PB_Path &&\ + make -j$(nproc) &&\ + make install &&\ ln -s /usr/local/lib/python3.5/dist-packages/orbslam2.so \ /usr/local/lib/python3.8/dist-packages/orbslam2.so ; fi @@ -160,36 +141,30 @@ ARG build_orbslam3=true RUN mkdir $Orb_Slam3_PB_Path RUN if $build_orbslam3 ; then \ + mkdir -p $Orb_Slam3_PB_Path && \ git clone -b ORBSLAM3 https://github.com/GiordanoLaminetti/ORB_SLAM2-PythonBindings.git \ - $Orb_Slam3_PB_Path ; fi - -RUN mkdir $Orb_Slam3_PB_Path/build -WORKDIR $Orb_Slam3_PB_Path/build - -RUN if $build_orbslam3 ; then \ - cmake .. ;\ - make -j7 ;\ - make install ;\ + $Orb_Slam3_PB_Path &&\ + mkdir $Orb_Slam3_PB_Path/build && \ + cd $Orb_Slam3_PB_Path/build && \ + cmake .. &&\ + make -j$(nproc) &&\ + make install &&\ ln -s /usr/local/lib/python3.5/dist-packages/orbslam3.so \ /usr/local/lib/python3.8/dist-packages/ ;fi #remove all the folder WORKDIR /slampy -RUN rm -rf /slampy/program -RUN ldconfig +RUN rm -rf /slampy/program && ldconfig -RUN pip3 install poetry setuptools #change user USER slampy COPY . /slampy/slampy WORKDIR /slampy/slampy -RUN poetry config virtualenvs.create false -RUN poetry install --no-root +RUN poetry config virtualenvs.create false && poetry install --no-root ENV PATH /slampy/.local/bin:$PATH -RUN jupyter nbextension enable --py widgetsnbextension -RUN jupyter nbextension enable --py plotlywidget +RUN jupyter nbextension enable --py widgetsnbextension && jupyter nbextension enable --py plotlywidget EXPOSE 8888 diff --git a/slam_method/Settings/OrbSlam2_TUM_freiburg3_.yaml b/slam_method/Settings/OrbSlam2_TUM_freiburg3_.yaml index ac42bb6..f7cbb17 100644 --- a/slam_method/Settings/OrbSlam2_TUM_freiburg3_.yaml +++ b/slam_method/Settings/OrbSlam2_TUM_freiburg3_.yaml @@ -10,11 +10,11 @@ Camera.fy: 521.007327 Camera.cx: 325.141442 Camera.cy: 249.701764 -Camera.k1: 0.231222 -Camera.k2: -0.784899 -Camera.p1: -0.003257 -Camera.p2: -0.000105 -Camera.k3: 0.917205 +Camera.k1: -0.365409 +Camera.k2: 0.1171 +Camera.p1: -0.000924922 +Camera.p2: -0.00489767 +Camera.k3: 0 # Camera frames per second Camera.fps: 30.0