Merge pull request #1338 from pierotofy/m1

M1 Changes
pull/1342/head
Piero Toffanin 2021-09-04 16:12:43 -04:00 zatwierdzone przez GitHub
commit bea173cfa6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
20 zmienionych plików z 500 dodań i 32 usunięć

Wyświetl plik

@ -39,7 +39,7 @@ jobs:
uses: docker/build-push-action@v2
with:
file: ./portable.Dockerfile
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.docker_meta.outputs.tags }}

Wyświetl plik

@ -1,8 +1,8 @@
FROM ubuntu:20.04 AS builder
FROM ubuntu:21.04 AS builder
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9/dist-packages:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
# Prepare directories
@ -21,11 +21,11 @@ RUN bash configure.sh clean
### Use a second image for the final asset to reduce the number and
# size of the layers.
FROM ubuntu:20.04
FROM ubuntu:21.04
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
WORKDIR /code

Wyświetl plik

@ -145,7 +145,7 @@ endif()
externalproject_add(mve
GIT_REPOSITORY https://github.com/OpenDroneMap/mve.git
GIT_TAG 250
GIT_TAG 262
UPDATE_COMMAND ""
SOURCE_DIR ${SB_SOURCE_DIR}/mve
CMAKE_ARGS ${WIN32_CMAKE_ARGS}
@ -169,7 +169,7 @@ else()
endif()
externalproject_add(poissonrecon
GIT_REPOSITORY https://github.com/OpenDroneMap/PoissonRecon.git
GIT_TAG 257
GIT_TAG 262
PREFIX ${SB_BINARY_DIR}/PoissonRecon
SOURCE_DIR ${SB_SOURCE_DIR}/PoissonRecon
UPDATE_COMMAND ""

Wyświetl plik

@ -9,7 +9,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}/${_proj_name}
GIT_REPOSITORY https://github.com/OpenDroneMap/mvs-texturing
GIT_TAG 250
GIT_TAG 262
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------

Wyświetl plik

@ -12,6 +12,11 @@ externalproject_add(vcg
INSTALL_COMMAND ""
)
SET(ARM64_CMAKE_ARGS "")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" )
SET(ARM64_CMAKE_ARGS -DOpenMVS_USE_SSE=OFF)
endif()
ExternalProject_Add(${_proj_name}
DEPENDS ceres opencv vcg
PREFIX ${_SB_BINARY_DIR}
@ -31,6 +36,7 @@ ExternalProject_Add(${_proj_name}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${SB_INSTALL_DIR}
${WIN32_CMAKE_ARGS}
${ARM64_CMAKE_ARGS}
#--Build step-----------------
BINARY_DIR ${_SB_BINARY_DIR}
#--Install step---------------

Wyświetl plik

@ -19,7 +19,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
GIT_REPOSITORY https://github.com/OpenDroneMap/OpenSfM/
GIT_TAG 261
GIT_TAG 262
#--Update/Patch step----------
UPDATE_COMMAND git submodule update --init --recursive
#--Configure step-------------

Wyświetl plik

@ -1 +1 @@
2.6.1
2.6.2

Wyświetl plik

@ -4,20 +4,20 @@
APT_GET="env DEBIAN_FRONTEND=noninteractive $(command -v apt-get)"
check_version(){
UBUNTU_VERSION=$(lsb_release -r)
export UBUNTU_VERSION=$(lsb_release -r)
case "$UBUNTU_VERSION" in
*"20.04"*)
*"20.04"*|*"21.04"*)
echo "Ubuntu: $UBUNTU_VERSION, good!"
;;
*"18.04"*|*"16.04"*)
echo "ODM 2.1 has upgraded to Ubuntu 20.04, but you're on $UBUNTU_VERSION"
echo "ODM 2.1 has upgraded to Ubuntu 21.04, but you're on $UBUNTU_VERSION"
echo "* The last version of ODM that supports Ubuntu 16.04 is v1.0.2."
echo "* The last version of ODM that supports Ubuntu 18.04 is v2.0.0."
echo "We recommend you to upgrade, or better yet, use docker."
exit 1
;;
*)
echo "You are not on Ubuntu 20.04 (detected: $UBUNTU_VERSION)"
echo "You are not on Ubuntu 21.04 (detected: $UBUNTU_VERSION)"
echo "It might be possible to run ODM on a newer version of Ubuntu, however, you cannot rely on this script."
exit 1
;;
@ -54,10 +54,12 @@ ensure_prereqs() {
echo "Installing tzdata"
sudo $APT_GET install -y -qq tzdata
if [[ "$UBUNTU_VERSION" == *"20.04"* ]]; then
echo "Enabling PPA for Ubuntu GIS"
sudo $APT_GET install -y -qq --no-install-recommends software-properties-common
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo $APT_GET update
fi
echo "Installing Python PIP"
sudo $APT_GET install -y -qq --no-install-recommends \
@ -77,7 +79,12 @@ installdepsfromsnapcraft() {
*) key=build-packages; ;; # shouldn't be needed, but it's here just in case
esac
cat snap/snapcraft.yaml | \
SNAPCRAFT_FILE="snapcraft.yaml"
if [[ "$UBUNTU_VERSION" == *"21.04"* ]]; then
SNAPCRAFT_FILE="snapcraft21.yaml"
fi
cat snap/$SNAPCRAFT_FILE | \
shyaml get-values-0 parts.$section.$key | \
xargs -0 sudo $APT_GET install -y -qq --no-install-recommends
}

Wyświetl plik

@ -9,4 +9,9 @@ do
fi
done
/usr/bin/g++_real -march=nehalem "${args[@]}"
ARCH=nehalem
if [[ $(uname -m) == "aarch64" ]]; then
ARCH=armv8-a
fi
/usr/bin/g++_real -march=$ARCH "${args[@]}"

Wyświetl plik

@ -9,4 +9,9 @@ do
fi
done
/usr/bin/gcc_real -march=nehalem "${args[@]}"
ARCH=nehalem
if [[ $(uname -m) == "aarch64" ]]; then
ARCH=armv8-a
fi
/usr/bin/gcc_real -march=$ARCH "${args[@]}"

Wyświetl plik

@ -2,7 +2,7 @@ FROM nvidia/cuda:11.2.0-runtime-ubuntu20.04 AS builder
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9/dist-packages:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
# Prepare directories
@ -25,7 +25,7 @@ FROM nvidia/cuda:11.2.0-runtime-ubuntu20.04
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9/dist-packages:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
WORKDIR /code

Wyświetl plik

@ -11,6 +11,7 @@ superbuild_bin_path = os.path.join(superbuild_path, 'install', 'bin')
# add opencv,opensfm to python path
python_packages_paths = [os.path.join(superbuild_path, p) for p in [
'install/lib/python3.9/dist-packages',
'install/lib/python3.8/dist-packages',
'install/lib/python3/dist-packages',
'install/bin/opensfm'

Wyświetl plik

@ -12,7 +12,7 @@ from opendm import system
from opendm.concurrency import get_max_memory, parallel_map
from scipy import ndimage
from datetime import datetime
from osgeo.utils.gdal_fillnodata import main as gdal_fillnodata
from opendm.vendor.gdal_fillnodata import main as gdal_fillnodata
from opendm import log
try:
import Queue as queue

0
opendm/vendor/__init__.py vendored 100644
Wyświetl plik

216
opendm/vendor/gdal_fillnodata.py vendored 100644
Wyświetl plik

@ -0,0 +1,216 @@
#!/usr/bin/env python3
# ******************************************************************************
# $Id: gdal_fillnodata.py 124baa7f71f15396a661014a81b6c5b0c82c8004 2020-10-14 17:29:39 +0300 Idan Miara $
#
# Project: GDAL Python Interface
# Purpose: Application for filling nodata areas in a raster by interpolation
# Author: Frank Warmerdam, warmerdam@pobox.com
#
# ******************************************************************************
# Copyright (c) 2008, Frank Warmerdam
# Copyright (c) 2009-2011, Even Rouault <even dot rouault at spatialys.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# ******************************************************************************
import sys
from osgeo import gdal
def CopyBand(srcband, dstband):
for line in range(srcband.YSize):
line_data = srcband.ReadRaster(0, line, srcband.XSize, 1)
dstband.WriteRaster(0, line, srcband.XSize, 1, line_data,
buf_type=srcband.DataType)
def Usage():
print("""
gdal_fillnodata [-q] [-md max_distance] [-si smooth_iterations]
[-o name=value] [-b band]
srcfile [-nomask] [-mask filename] [-of format] [-co name=value]* [dstfile]
""")
sys.exit(1)
def main(argv):
max_distance = 100
smoothing_iterations = 0
options = []
quiet_flag = 0
src_filename = None
src_band = 1
dst_filename = None
frmt = 'GTiff'
creation_options = []
mask = 'default'
gdal.AllRegister()
argv = gdal.GeneralCmdLineProcessor(argv)
if argv is None:
sys.exit(0)
# Parse command line arguments.
i = 1
while i < len(argv):
arg = argv[i]
if arg == '-of' or arg == '-f':
i = i + 1
frmt = argv[i]
elif arg == '-co':
i = i + 1
creation_options.append(argv[i])
elif arg == '-q' or arg == '-quiet':
quiet_flag = 1
elif arg == '-si':
i = i + 1
smoothing_iterations = int(argv[i])
elif arg == '-b':
i = i + 1
src_band = int(argv[i])
elif arg == '-md':
i = i + 1
max_distance = float(argv[i])
elif arg == '-nomask':
mask = 'none'
elif arg == '-mask':
i = i + 1
mask = argv[i]
elif arg == '-mask':
i = i + 1
mask = argv[i]
elif arg[:2] == '-h':
Usage()
elif src_filename is None:
src_filename = argv[i]
elif dst_filename is None:
dst_filename = argv[i]
else:
Usage()
i = i + 1
if src_filename is None:
Usage()
# =============================================================================
# Verify we have next gen bindings with the sievefilter method.
# =============================================================================
try:
gdal.FillNodata
except AttributeError:
print('')
print('gdal.FillNodata() not available. You are likely using "old gen"')
print('bindings or an older version of the next gen bindings.')
print('')
sys.exit(1)
# =============================================================================
# Open source file
# =============================================================================
if dst_filename is None:
src_ds = gdal.Open(src_filename, gdal.GA_Update)
else:
src_ds = gdal.Open(src_filename, gdal.GA_ReadOnly)
if src_ds is None:
print('Unable to open %s' % src_filename)
sys.exit(1)
srcband = src_ds.GetRasterBand(src_band)
if mask == 'default':
maskband = srcband.GetMaskBand()
elif mask == 'none':
maskband = None
else:
mask_ds = gdal.Open(mask)
maskband = mask_ds.GetRasterBand(1)
# =============================================================================
# Create output file if one is specified.
# =============================================================================
if dst_filename is not None:
drv = gdal.GetDriverByName(frmt)
dst_ds = drv.Create(dst_filename, src_ds.RasterXSize, src_ds.RasterYSize, 1,
srcband.DataType, creation_options)
wkt = src_ds.GetProjection()
if wkt != '':
dst_ds.SetProjection(wkt)
gt = src_ds.GetGeoTransform(can_return_null=True)
if gt:
dst_ds.SetGeoTransform(gt)
dstband = dst_ds.GetRasterBand(1)
CopyBand(srcband, dstband)
ndv = srcband.GetNoDataValue()
if ndv is not None:
dstband.SetNoDataValue(ndv)
color_interp = srcband.GetColorInterpretation()
dstband.SetColorInterpretation(color_interp)
if color_interp == gdal.GCI_PaletteIndex:
color_table = srcband.GetColorTable()
dstband.SetColorTable(color_table)
else:
dstband = srcband
# =============================================================================
# Invoke algorithm.
# =============================================================================
if quiet_flag:
prog_func = None
else:
prog_func = gdal.TermProgress_nocb
result = gdal.FillNodata(dstband, maskband,
max_distance, smoothing_iterations, options,
callback=prog_func)
src_ds = None
dst_ds = None
mask_ds = None
return result
if __name__ == '__main__':
sys.exit(main(sys.argv))

Wyświetl plik

@ -1,8 +1,8 @@
FROM ubuntu:20.04 AS builder
FROM ubuntu:21.04 AS builder
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9/dist-packages:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
# Prepare directories
@ -21,11 +21,11 @@ RUN bash configure.sh clean
### Use a second image for the final asset to reduce the number and
# size of the layers.
FROM ubuntu:20.04
FROM ubuntu:21.04
# Env variables
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.9/dist-packages:/code/SuperBuild/install/lib/python3.8/dist-packages:/code/SuperBuild/src/opensfm" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
WORKDIR /code

Wyświetl plik

@ -11,7 +11,7 @@ laspy==1.7.0
lxml==4.6.1
matplotlib==3.3.3
networkx==2.5
numpy==1.19.4
numpy==1.21.1
Pillow==8.0.1
vmem==1.0.1
pyodm==1.5.6

3
run.py
Wyświetl plik

@ -6,6 +6,7 @@ if sys.version_info.major < 3:
print("Ups! ODM needs to run with Python 3. It seems you launched it with Python 2. Try using: python3 run.py ... ")
sys.exit(1)
import os
from opendm import log
from opendm import config
from opendm import system
@ -14,8 +15,6 @@ from opendm.progress import progressbc
from opendm.utils import double_quote, get_processing_results_paths
from opendm.loghelpers import args_to_dict
import os
from stages.odm_app import ODMApp
if __name__ == '__main__':

Wyświetl plik

@ -61,6 +61,7 @@ parts:
- libspqr2
- libssl1.1
- libusb-1.0-0
- proj-data
- procps
- python3
- python3-distutils

Wyświetl plik

@ -0,0 +1,228 @@
name: opendronemap
adopt-info: odm
grade: stable
confinement: strict
base: core21
summary: Command line toolkit for processing aerial drone imagery
description: >
An open source command line toolkit for processing aerial drone imagery. ODM turns simple 2D images into:
* Classified Point Clouds
* 3D Textured Models
* Georeferenced Orthorectified Imagery
* Georeferenced Digital Elevation Models
The application is available for Windows, Mac and Linux and it works from the command line, making it ideal for power users, scripts and for integration with other software.
# The UbuntuGIS PPA only has i386 and amd64 packages so we can't build any
# other architectures. Therefore let's limit to those here.
architectures:
- build-on: i386
run-on: i386
- build-on: amd64
run-on: amd64
package-repositories:
- type: apt
ppa: ubuntugis/ubuntugis-unstable
parts:
prereqs:
source: .
plugin: nil
build-packages:
- build-essential
- cmake
- gdal-bin
- gfortran # to build scipy
- git
- libboost-log-dev
- libgdal-dev
- libgeotiff-dev
- libjsoncpp-dev
- libssl-dev
- libusb-1.0-0-dev
- ninja-build
- pkg-config
- python3-dev
- python3-gdal
- python3-pip
- python3-setuptools
- python3-wheel
- rsync
- swig3.0
stage-packages:
- gdal-bin
- libboost-log1.74.0
- libgdal28
- libgeotiff5
- libjsoncpp24
- libspqr2
- libssl1.1
- libusb-1.0-0
- proj-data
- procps
- python3
- python3-distutils
- python3-gdal
- python3-pkg-resources # required base package for core20
- python3-requests # required base package for core20
- python3-setuptools
stage:
# remove deb-based numpy because it conflicts with our pip-installed version
- -usr/lib/python3/dist-packages/numpy
opencv:
source: .
plugin: nil
build-packages:
- libavcodec-dev
- libavformat-dev
- libeigen3-dev
- libflann-dev
- libgtk2.0-dev
- libjpeg-dev
- liblapack-dev
- libopenjpip7
- libpng-dev
- libproj-dev
- libswscale-dev
- libtbb-dev
- libtiff-dev
- libxext-dev
- proj-bin
stage-packages:
- libavcodec58
- libavformat58
- libflann1.9
- libgtk2.0-0
- libjpeg-turbo8
- libopenjpip7
- liblapack3
- libpng16-16
- libproj19
- libswscale5
- libtbb2
- libtiff5
- libwebpdemux2
- libxext6
openmvs:
source: .
plugin: nil
build-packages:
- libcgal-dev
- libboost-program-options-dev
stage-packages:
- libboost-program-options1.74.0
opensfm:
source: .
plugin: nil
build-packages:
- libboost-date-time-dev
- libboost-filesystem-dev
- libboost-iostreams-dev
- libboost-python-dev
- libboost-regex-dev
- libboost-serialization-dev
- libboost-system-dev
- libboost-thread-dev
- libgoogle-glog-dev
- libsuitesparse-dev
stage-packages:
- libamd2
- libboost-date-time1.74.0
- libboost-filesystem1.74.0
- libboost-iostreams1.74.0
- libboost-python1.74.0
- libboost-regex1.74.0
- libboost-serialization1.74.0
- libboost-system1.74.0
- libboost-thread1.74.0
- libcamd2
- libccolamd2
- libcholmod3
- libcolamd2
- libcxsparse3
- libgoogle-glog0v5
- libsuitesparseconfig5
odm:
after:
- prereqs
- opencv
- opensfm
- openmvs
source: .
plugin: nil # We will script everything ourselves
build-environment:
# Set Python location to build host's system so that we can
# use system libraries while building the Snap Package
- PYTHONHOME: /usr
# Set the location for pip to install requirements into inside
# the Snap package
- PYTHONUSERBASE: $SNAPCRAFT_PART_INSTALL
override-build: |
snapcraftctl set-version $(cat VERSION)
# Portable build
test -f /usr/bin/gcc_real || mv -v /usr/bin/gcc /usr/bin/gcc_real
test -f /usr/bin/gcc || cp -v ./docker/gcc /usr/bin/gcc
test -f /usr/bin/g++_real || mv -v /usr/bin/g++ /usr/bin/g++_real
test -f /usr/bin/g++ || cp -v ./docker/g++ /usr/bin/g++
pip3 install --user -r requirements.txt
# Build the SuperBuild libraries
mkdir -p SuperBuild/build
cd SuperBuild/build
cmake -G Ninja ..
cmake --build . --parallel 1
rsync -av --exclude .git \
$SNAPCRAFT_PART_BUILD/ $SNAPCRAFT_PART_INSTALL/odm/
chmod -R u=rwX,go=rX $PYTHONUSERBASE/lib/python*
stage:
# strip the temporary build files and sources
- -odm/SuperBuild/build
- -odm/SuperBuild/download
- -odm/SuperBuild/src
prime:
# remove any static-libraries
- -**/*.a
# remove any header files
- -**/*.h
# remove any left-over temporary compiled 'object' files
- -**/*.o
build-snaps:
- cmake
snap-specifics:
source: snap/local
plugin: dump
snapcraft-preload:
source: https://github.com/sergiusens/snapcraft-preload.git
plugin: cmake
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/
build-packages:
- on amd64:
- gcc-multilib
- g++-multilib
apps:
opendronemap:
command: odm/run.sh
command-chain:
- bin/snapcraft-preload # Fixes multiprocessing python module
environment:
# Ensure libraries are found
LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack:$LD_LIBRARY_PATH
plugs:
- home
- network
- network-bind
- removable-media