From 3a6b917c86bcb0cfd9e8140d3c9c25f77f3372a9 Mon Sep 17 00:00:00 2001 From: Mark Hale Date: Tue, 4 Apr 2017 17:54:40 +0100 Subject: [PATCH 1/4] Added support for resume from opensfm reconstruction stages. Former-commit-id: 7cc9e00410eeda14d7c75946df11f85710bc88e6 --- opendm/types.py | 2 ++ scripts/opensfm.py | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/opendm/types.py b/opendm/types.py index 12ff3b26..9c47e7e9 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -368,6 +368,8 @@ class ODM_Tree(object): self.opensfm_bundle_list = io.join_paths(self.opensfm, 'list_r000.out') self.opensfm_image_list = io.join_paths(self.opensfm, 'image_list.txt') self.opensfm_reconstruction = io.join_paths(self.opensfm, 'reconstruction.json') + self.opensfm_reconstruction_meshed = io.join_paths(self.opensfm, 'reconstruction.meshed.json') + self.opensfm_reconstruction_nvm = io.join_paths(self.opensfm, 'reconstruction.nvm.json') self.opensfm_model = io.join_paths(self.opensfm, 'depthmaps/merged.ply') # pmvs diff --git a/scripts/opensfm.py b/scripts/opensfm.py index 6a8d5b87..8f8a0906 100644 --- a/scripts/opensfm.py +++ b/scripts/opensfm.py @@ -99,14 +99,31 @@ class ODMOpenSfMCell(ecto.Cell): else: log.ODM_WARNING('Found a valid OpenSfM tracks file in: %s' % tree.opensfm_tracks) + log.ODM_WARNING('Found a valid OpenSfM tracks file in: %s' % + tree.opensfm_tracks) - system.run('PYTHONPATH=%s %s/bin/opensfm reconstruct %s' % - (context.pyopencv_path, context.opensfm_path, tree.opensfm)) - system.run('PYTHONPATH=%s %s/bin/opensfm mesh %s' % - (context.pyopencv_path, context.opensfm_path, tree.opensfm)) - if not args.use_pmvs: - system.run('PYTHONPATH=%s %s/bin/opensfm export_visualsfm %s' % + if not io.file_exists(tree.opensfm_reconstruction) or rerun_cell: + system.run('PYTHONPATH=%s %s/bin/opensfm reconstruct %s' % (context.pyopencv_path, context.opensfm_path, tree.opensfm)) + else: + log.ODM_WARNING('Found a valid OpenSfM reconstruction file in: %s' % + tree.opensfm_reconstruction) + + if not io.file_exists(tree.opensfm_reconstruction_meshed) or rerun_cell: + system.run('PYTHONPATH=%s %s/bin/opensfm mesh %s' % + (context.pyopencv_path, context.opensfm_path, tree.opensfm)) + else: + log.ODM_WARNING('Found a valid OpenSfM meshed reconstruction file in: %s' % + tree.opensfm_reconstruction_meshed) + + if not args.use_pmvs: + if not io.file_exists(tree.opensfm_reconstruction_nvm) or rerun_cell: + system.run('PYTHONPATH=%s %s/bin/opensfm export_visualsfm %s' % + (context.pyopencv_path, context.opensfm_path, tree.opensfm)) + else: + log.ODM_WARNING('Found a valid OpenSfM NVM reconstruction file in: %s' % + tree.opensfm_reconstruction_nvm) + system.run('PYTHONPATH=%s %s/bin/opensfm undistort %s' % (context.pyopencv_path, context.opensfm_path, tree.opensfm)) system.run('PYTHONPATH=%s %s/bin/opensfm compute_depthmaps %s' % From 529ab53d142505e525eba407f9ba594c49edfcf9 Mon Sep 17 00:00:00 2001 From: Mark Hale Date: Tue, 4 Apr 2017 18:02:40 +0100 Subject: [PATCH 2/4] Added support for resume from opensfm reconstruction stages. Former-commit-id: 9af9091ab091478e786eaac2c23aaca16056c5a2 --- scripts/opensfm.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/opensfm.py b/scripts/opensfm.py index 8f8a0906..5032e0e8 100644 --- a/scripts/opensfm.py +++ b/scripts/opensfm.py @@ -99,8 +99,6 @@ class ODMOpenSfMCell(ecto.Cell): else: log.ODM_WARNING('Found a valid OpenSfM tracks file in: %s' % tree.opensfm_tracks) - log.ODM_WARNING('Found a valid OpenSfM tracks file in: %s' % - tree.opensfm_tracks) if not io.file_exists(tree.opensfm_reconstruction) or rerun_cell: system.run('PYTHONPATH=%s %s/bin/opensfm reconstruct %s' % From 3a16534d4b607dfc61451217e17f470bcfb2fef9 Mon Sep 17 00:00:00 2001 From: Mark Hale Date: Thu, 6 Apr 2017 06:31:03 +0100 Subject: [PATCH 3/4] Fixed incorrect filename. Former-commit-id: a274520b1b4a7fd55d1f775f204729ea965ea2db --- opendm/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendm/types.py b/opendm/types.py index 9c47e7e9..8c8b088f 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -369,7 +369,7 @@ class ODM_Tree(object): self.opensfm_image_list = io.join_paths(self.opensfm, 'image_list.txt') self.opensfm_reconstruction = io.join_paths(self.opensfm, 'reconstruction.json') self.opensfm_reconstruction_meshed = io.join_paths(self.opensfm, 'reconstruction.meshed.json') - self.opensfm_reconstruction_nvm = io.join_paths(self.opensfm, 'reconstruction.nvm.json') + self.opensfm_reconstruction_nvm = io.join_paths(self.opensfm, 'reconstruction.nvm') self.opensfm_model = io.join_paths(self.opensfm, 'depthmaps/merged.ply') # pmvs From aaeaca736e6ba4b6c5f126ed6151e427f9e19e0b Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 6 Apr 2017 08:35:04 -0400 Subject: [PATCH 4/4] Cleaned up dockerfile, updated core2.dockerfile, removed unused packages.dockerfile (#536) Former-commit-id: 99ff9b856e0e9668fb083273516bd3f8e5c17aac --- Dockerfile | 7 ------ core2.Dockerfile | 52 +++++++++++++++++++++++++++++++++++---------- packages.Dockerfile | 36 ------------------------------- 3 files changed, 41 insertions(+), 54 deletions(-) delete mode 100644 packages.Dockerfile diff --git a/Dockerfile b/Dockerfile index 32ae3183..2fe08e01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ -#Pull in previously built packages image with lots of libraries. FROM phusion/baseimage - # Env variables ENV DEBIAN_FRONTEND noninteractive @@ -27,14 +25,11 @@ ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" - # Prepare directories RUN mkdir /code WORKDIR /code - - # Copy repository files COPY ccd_defs_check.py /code/ccd_defs_check.py COPY CMakeLists.txt /code/CMakeLists.txt @@ -53,7 +48,6 @@ COPY VERSION /code/VERSION RUN cd SuperBuild && mkdir build && cd build && cmake .. && make -j$(nproc) && cd ../.. && mkdir build && cd build && cmake .. && make -j$(nproc) - RUN apt-get -y remove libgl1-mesa-dri git cmake python-pip build-essential RUN apt-get install -y libvtk5-dev @@ -65,7 +59,6 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN rm -rf /code/SuperBuild/download RUN rm -rf /code/SuperBuild/src/opencv/samples /code/SuperBuild/src/pcl/test /code/SuperBuild/src/pcl/doc /code/SuperBuild/src/pdal/test /code/SuperBuild/src/pdal/doc - # Entry point ENTRYPOINT ["python", "/code/run.py", "code"] diff --git a/core2.Dockerfile b/core2.Dockerfile index 786d40e9..60035506 100644 --- a/core2.Dockerfile +++ b/core2.Dockerfile @@ -1,7 +1,32 @@ -#Pull in previously built packages image with lots of libraries. -FROM packages +FROM phusion/baseimage + +# Env variables +ENV DEBIAN_FRONTEND noninteractive + +#Install dependencies +#Required Requisites +RUN add-apt-repository -y ppa:ubuntugis/ppa +RUN add-apt-repository -y ppa:george-edison55/cmake-3.x +RUN apt-get update -y + +# All packages (Will install much faster) +RUN apt-get install --no-install-recommends -y git cmake python-pip build-essential software-properties-common python-software-properties libgdal-dev gdal-bin libgeotiff-dev \ +libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libflann-dev \ +libproj-dev libxext-dev liblapack-dev libeigen3-dev libvtk5-dev python-networkx libgoogle-glog-dev libsuitesparse-dev libboost-filesystem-dev libboost-iostreams-dev \ +libboost-regex-dev libboost-python-dev libboost-date-time-dev libboost-thread-dev python-pyproj python-empy python-nose python-pyside python-pyexiv2 python-scipy \ +jhead liblas-bin python-matplotlib libatlas-base-dev + +RUN apt-get remove libdc1394-22-dev +RUN pip install --upgrade pip +RUN pip install setuptools +RUN pip install -U PyYAML exifread gpxpy xmltodict catkin-pkg appsettings + +ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages" +ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" # Prepare directories + RUN mkdir /code WORKDIR /code @@ -9,9 +34,6 @@ WORKDIR /code COPY ccd_defs_check.py /code/ccd_defs_check.py COPY CMakeLists.txt /code/CMakeLists.txt COPY configure.sh /code/configure.sh -COPY /.git/ /code/.git/ -COPY .gitignore /code/.gitignore -COPY .gitmodules /code/.gitmodules COPY /modules/ /code/modules/ COPY /opendm/ /code/opendm/ COPY /patched_files/ /code/patched_files/ @@ -20,19 +42,27 @@ COPY /scripts/ /code/scripts/ COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/ COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt COPY docker.settings.yaml /code/settings.yaml -COPY /tests/ /code/tests/ COPY VERSION /code/VERSION -# Update submodules -RUN git submodule init && git submodule update - # Replace g++ and gcc with our own scripts COPY /docker/ /code/docker/ RUN mv -v /usr/bin/gcc /usr/bin/gcc_real && mv -v /usr/bin/g++ /usr/bin/g++_real && cp -v /code/docker/gcc /usr/bin/gcc && cp -v /code/docker/g++ /usr/bin/g++ #Compile code in SuperBuild and root directories -RUN cd SuperBuild && mkdir build && cd build && cmake .. && make -j$(nproc) \ - && cd ../.. && mkdir build && cd build && cmake .. && make -j$(nproc) + +RUN cd SuperBuild && mkdir build && cd build && cmake .. && make -j$(nproc) && cd ../.. && mkdir build && cd build && cmake .. && make -j$(nproc) + +RUN apt-get -y remove libgl1-mesa-dri git cmake python-pip build-essential +RUN apt-get install -y libvtk5-dev + +# Cleanup APT +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Clean Superbuild + +RUN rm -rf /code/SuperBuild/download +RUN rm -rf /code/SuperBuild/src/opencv/samples /code/SuperBuild/src/pcl/test /code/SuperBuild/src/pcl/doc /code/SuperBuild/src/pdal/test /code/SuperBuild/src/pdal/doc # Entry point ENTRYPOINT ["python", "/code/run.py", "code"] + diff --git a/packages.Dockerfile b/packages.Dockerfile deleted file mode 100644 index 07cf0f54..00000000 --- a/packages.Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM phusion/baseimage -MAINTAINER Alex Hagiopol - -# Env variables -ENV DEBIAN_FRONTEND noninteractive - -#Install dependencies -#Required Requisites -RUN add-apt-repository -y ppa:ubuntugis/ppa -RUN add-apt-repository -y ppa:george-edison55/cmake-3.x -RUN apt-get update -y - -# All packages (Will install much faster) -RUN apt-get install -y build-essential cmake git python-pip pkg-config software-properties-common python-software-properties libgdal-dev gdal-bin libgeotiff-dev \ -libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libflann-dev \ -libproj-dev libxext-dev liblapack-dev libeigen3-dev libvtk5-dev python-networkx libgoogle-glog-dev libsuitesparse-dev libboost-filesystem-dev libboost-iostreams-dev \ -libboost-regex-dev libboost-python-dev libboost-date-time-dev libboost-thread-dev python-pyproj python-empy python-nose python-pyside python-pyexiv2 python-scipy \ -jhead liblas-bin python-matplotlib libatlas-base-dev - -RUN apt-get remove libdc1394-22-dev - -RUN pip install -U PyYAML \ - exifread \ - gpxpy \ - xmltodict \ - catkin-pkg \ - appsettings - - -RUN apt-get clean -y - - -ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages" -ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" -ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" -