diff --git a/Dockerfile b/Dockerfile index 401bcb7..0314377 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,36 +5,14 @@ EXPOSE 3000 USER root RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash - -RUN apt-get install -y nodejs python-gdal libboost-dev libboost-program-options-dev git cmake -RUN npm install -g nodemon - -# Build LASzip and PotreeConverter -WORKDIR "/staging" -RUN git clone https://github.com/pierotofy/LAStools /staging/LAStools && \ - cd LAStools/LASzip && \ - mkdir build && \ - cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release .. && \ - make - -RUN git clone https://github.com/pierotofy/PotreeConverter /staging/PotreeConverter -RUN cd /staging/PotreeConverter && \ - mkdir build && \ - cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=/staging/LAStools/LASzip/dll -DLASZIP_LIBRARY=/staging/LAStools/LASzip/build/src/liblaszip.a .. && \ - make && \ - make install +RUN apt-get install -y nodejs python-gdal && npm install -g nodemon && \ + ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine RUN mkdir /var/www WORKDIR "/var/www" - -#RUN git clone https://github.com/OpenDroneMap/node-OpenDroneMap . - COPY . /var/www - -RUN npm install -RUN mkdir tmp +RUN npm install && mkdir tmp ENTRYPOINT ["/usr/bin/nodejs", "/var/www/index.js"] diff --git a/README.md b/README.md index 8d35bd6..a38507d 100644 --- a/README.md +++ b/README.md @@ -52,27 +52,9 @@ This can be also used to access the computation results directly from the file s If you are already running [ODM](https://github.com/OpenDroneMap/ODM) on Ubuntu natively you can follow these steps: -1) Install PotreeConverter and LASzip dependency +1) Install Entwine: https://entwine.io/quickstart.html#installation -```bash -apt-get install -y libboost-dev libboost-program-options-dev - -mkdir /staging -git clone https://github.com/pierotofy/LAStools /staging/LAStools -cd LAStools/LASzip -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make - -git clone https://github.com/pierotofy/PotreeConverter /staging/PotreeConverter -cd /staging/PotreeConverter -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=/staging/LAStools/LASzip/dll -DLASZIP_LIBRARY=/staging/LAStools/LASzip/build/src/liblaszip.a .. -make && sudo make install -``` -2) Install gdal2tiles.py script, node.js and npm dependencies +2) Install node.js and npm dependencies: ```bash sudo curl --silent --location https://deb.nodesource.com/setup_6.x | sudo bash - diff --git a/scripts/postprocess.sh b/scripts/postprocess.sh index 1bdf835..043231c 100755 --- a/scripts/postprocess.sh +++ b/scripts/postprocess.sh @@ -70,38 +70,60 @@ else echo "gdal_translate is not installed, will skip MBTiles generation" fi -# Generate Potree point cloud (if PotreeConverter is available) -if hash PotreeConverter 2>/dev/null; then - potree_input_path="" - for path in "odm_georeferencing/odm_georeferenced_model.laz" \ - "odm_georeferencing/odm_georeferenced_model.las" \ - "odm_georeferencing/odm_georeferenced_model.ply" \ - "opensfm/depthmaps/merged.ply" \ - "smvs/smvs_dense_point_cloud.ply" \ - "mve/mve_dense_point_cloud.ply" \ - "pmvs/recon0/models/option-0000.ply"; do - if [ -e $path ]; then - echo "Found suitable point cloud for PotreeConverter: $path" - potree_input_path=$path - break - fi - done +# Generate point cloud (if entwine or potreeconverter is available) +pointcloud_input_path="" +for path in "odm_georeferencing/odm_georeferenced_model.laz" \ + "odm_georeferencing/odm_georeferenced_model.las" \ + "odm_filterpoints/point_cloud.ply" \ + "opensfm/depthmaps/merged.ply" \ + "smvs/smvs_dense_point_cloud.ply" \ + "mve/mve_dense_point_cloud.ply" \ + "pmvs/recon0/models/option-0000.ply"; do + if [ -e $path ]; then + echo "Found point cloud: $path" + pointcloud_input_path=$path + break + fi +done - if [ ! -z "$potree_input_path" ]; then - PotreeConverter $potree_input_path -o potree_pointcloud --overwrite -a RGB CLASSIFICATION - - # Copy the failsafe PLY point cloud to odm_georeferencing - # if necessary, otherwise it will not get zipped - if [ "$potree_input_path" == "opensfm/depthmaps/merged.ply" ] || [ "$potree_input_path" == "pmvs/recon0/models/option-0000.ply" ]; then - echo "Copying $potree_input_path to odm_georeferencing/odm_georeferenced_model.ply, even though it's not georeferenced..." - cp $potree_input_path "odm_georeferencing/odm_georeferenced_model.ply" - fi - else - echo "Potree point cloud will not be generated (no suitable input files found)" - fi -else - echo "PotreeConverter is not installed, will skip generation of Potree point cloud" +# Never generate point cloud tiles with split-merge workflows +if [ -e "submodels" ] && [ -e "entwine_pointcloud" ]; then + pointcloud_input_path="" + echo "Split-merge dataset with point cloud detected. No need to regenerate point cloud tiles." fi +if [ ! -z "$pointcloud_input_path" ]; then + # Copy the failsafe PLY point cloud to odm_georeferencing + # if necessary, otherwise it will not get zipped + if [ "$pointcloud_input_path" == "odm_filterpoints/point_cloud.ply" ] || [ "$pointcloud_input_path" == "opensfm/depthmaps/merged.ply" ] || [ "$pointcloud_input_path" == "pmvs/recon0/models/option-0000.ply" ]; then + echo "Copying $pointcloud_input_path to odm_georeferencing/odm_georeferenced_model.ply, even though it's not georeferenced..." + cp $pointcloud_input_path "odm_georeferencing/odm_georeferenced_model.ply" + fi + + if hash entwine 2>/dev/null; then + # Optionally cleanup previous results (from a restart) + if [ -e "entwine_pointcloud" ]; then + rm -fr "entwine_pointcloud" + fi + + entwine build --threads $(nproc) --tmp "entwine_pointcloud-tmp" -i "$pointcloud_input_path" -o entwine_pointcloud + + # Cleanup + if [ -e "entwine_pointcloud-tmp" ]; then + rm -fr "entwine_pointcloud-tmp" + fi + else + echo "Entwine is not installed, checking if PotreeConverter is available instead..." + if hash PotreeConverter 2>/dev/null; then + PotreeConverter "$pointcloud_input_path" -o potree_pointcloud --overwrite -a RGB CLASSIFICATION + else + echo "PotreeConverter is also not installed, will skip generation of Potree point cloud" + fi + fi +else + echo "Point cloud tiles will not be generated" +fi + + echo "Postprocessing: done (•̀ᴗ•́)و!" exit 0