Skip to content

Commit

Permalink
Merge pull request #1308 from pierotofy/257
Browse files Browse the repository at this point in the history
PoissonRecon updates, OpenSfM updates
  • Loading branch information
pierotofy authored Jun 21, 2021
2 parents 3c6b978 + bdd83dc commit 9fe8be2
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-docker-and-wsl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-docker-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Build
id: build
uses: diddlesnaps/snapcraft-multiarch-action@v1
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test-build-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -29,6 +33,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Build
id: build
uses: diddlesnaps/snapcraft-multiarch-action@v1
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ else()
endif()
externalproject_add(poissonrecon
GIT_REPOSITORY https://github.com/OpenDroneMap/PoissonRecon.git
GIT_TAG 250
GIT_TAG 257
PREFIX ${SB_BINARY_DIR}/PoissonRecon
SOURCE_DIR ${SB_SOURCE_DIR}/PoissonRecon
UPDATE_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/cmake/External-OpenSfM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
GIT_REPOSITORY https://github.com/OpenDroneMap/OpenSfM/
GIT_TAG 256
GIT_TAG 257
#--Update/Patch step----------
UPDATE_COMMAND git submodule update --init --recursive
#--Configure step-------------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.6
2.5.7
14 changes: 10 additions & 4 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ installruntimedepsonly() {
installdepsfromsnapcraft runtime openmvs

}
install() {

installreqs() {
cd /code

## Set up library paths
Expand All @@ -123,6 +123,10 @@ install() {
if [ ! -z "$GPU_INSTALL" ]; then
pip install --ignore-installed -r requirements.gpu.txt
fi
}

install() {
installreqs

if [ ! -z "$PORTABLE_INSTALL" ]; then
echo "Replacing g++ and gcc with our scripts for portability..."
Expand Down Expand Up @@ -176,7 +180,7 @@ clean() {

usage() {
echo "Usage:"
echo "bash configure.sh <install|update|uninstall|help> [nproc]"
echo "bash configure.sh <install|update|uninstall|installreqs|help> [nproc]"
echo "Subcommands:"
echo " install"
echo " Installs all dependencies and modules for running OpenDroneMap"
Expand All @@ -186,14 +190,16 @@ usage() {
echo " Removes SuperBuild and build modules, then re-installs them. Note this does not update OpenDroneMap to the latest version. "
echo " uninstall"
echo " Removes SuperBuild and build modules. Does not uninstall dependencies"
echo " installreqs"
echo " Only installs the requirements (does not build SuperBuild)"
echo " clean"
echo " Cleans the SuperBuild directory by removing temporary files. "
echo " help"
echo " Displays this message"
echo "[nproc] is an optional argument that can set the number of processes for the make -j tag. By default it uses $(nproc)"
}

if [[ $1 =~ ^(install|installruntimedepsonly|reinstall|uninstall|clean)$ ]]; then
if [[ $1 =~ ^(install|installruntimedepsonly|reinstall|uninstall|installreqs|clean)$ ]]; then
RUNPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
"$1"
else
Expand Down
62 changes: 41 additions & 21 deletions opendm/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from opendm import system
from opendm import log
from opendm import context
from opendm import concurrency
from scipy import signal
import numpy as np

Expand Down Expand Up @@ -145,33 +146,52 @@ def screened_poisson_reconstruction(inPointCloud, outMesh, depth = 8, samples =
# ext = .ply

outMeshDirty = os.path.join(mesh_path, "{}.dirty{}".format(basename, ext))
if os.path.isfile(outMeshDirty):
os.remove(outMeshDirty)

# Since PoissonRecon has some kind of a race condition on ppc64el, and this helps...
if platform.machine() == 'ppc64le':
log.ODM_WARNING("ppc64le platform detected, forcing single-threaded operation for PoissonRecon")
threads = 1

poissonReconArgs = {
'bin': context.poisson_recon_path,
'outfile': outMeshDirty,
'infile': inPointCloud,
'depth': depth,
'samples': samples,
'pointWeight': pointWeight,
'threads': threads,
'verbose': '--verbose' if verbose else ''
}

# Run PoissonRecon
system.run('"{bin}" --in "{infile}" '
'--out "{outfile}" '
'--depth {depth} '
'--pointWeight {pointWeight} '
'--samplesPerNode {samples} '
'--threads {threads} '
'--bType 2 '
'--linearFit '
'{verbose}'.format(**poissonReconArgs))
while True:
poissonReconArgs = {
'bin': context.poisson_recon_path,
'outfile': outMeshDirty,
'infile': inPointCloud,
'depth': depth,
'samples': samples,
'pointWeight': pointWeight,
'threads': int(threads),
'memory': int(concurrency.get_max_memory_mb(4, 0.8) // 1024),
'verbose': '--verbose' if verbose else ''
}

# Run PoissonRecon
system.run('"{bin}" --in "{infile}" '
'--out "{outfile}" '
'--depth {depth} '
'--pointWeight {pointWeight} '
'--samplesPerNode {samples} '
'--threads {threads} '
'--maxMemory {memory} '
'--bType 2 '
'--linearFit '
'{verbose}'.format(**poissonReconArgs))

if os.path.isfile(outMeshDirty):
break # Done!
else:

# PoissonRecon will sometimes fail due to race conditions
# on certain machines, especially on Windows
threads //= 2

if threads < 1:
break
else:
log.ODM_WARNING("PoissonRecon failed with %s threads, let's retry with %s..." % (threads, threads // 2))


# Cleanup and reduce vertex count if necessary
cleanupArgs = {
Expand Down

0 comments on commit 9fe8be2

Please sign in to comment.