kopia lustrzana https://github.com/OpenDroneMap/ODM
Add --copy-to option (#1291)
* Add --copy-to option * Fix snapcraft * Remove comment * remove commentpull/1292/head
rodzic
37396921f9
commit
29ab4fd892
|
@ -21,7 +21,6 @@ jobs:
|
||||||
id: build
|
id: build
|
||||||
uses: diddlesnaps/snapcraft-multiarch-action@v1
|
uses: diddlesnaps/snapcraft-multiarch-action@v1
|
||||||
with:
|
with:
|
||||||
snapcraft-args: --enable-experimental-package-repositories
|
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
- name: Review
|
- name: Review
|
||||||
uses: diddlesnaps/snapcraft-review-tools-action@v1
|
uses: diddlesnaps/snapcraft-review-tools-action@v1
|
||||||
|
|
|
@ -33,7 +33,6 @@ jobs:
|
||||||
id: build
|
id: build
|
||||||
uses: diddlesnaps/snapcraft-multiarch-action@v1
|
uses: diddlesnaps/snapcraft-multiarch-action@v1
|
||||||
with:
|
with:
|
||||||
snapcraft-args: --enable-experimental-package-repositories
|
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
- name: Review
|
- name: Review
|
||||||
uses: diddlesnaps/snapcraft-review-tools-action@v1
|
uses: diddlesnaps/snapcraft-review-tools-action@v1
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.5.1
|
2.5.2
|
||||||
|
|
|
@ -587,6 +587,11 @@ def config(argv=None, parser=None):
|
||||||
default=False,
|
default=False,
|
||||||
help='Print additional messages to the console. '
|
help='Print additional messages to the console. '
|
||||||
'Default: %(default)s')
|
'Default: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--copy-to',
|
||||||
|
metavar='<path>',
|
||||||
|
action=StoreValue,
|
||||||
|
help='Copy output results to this folder after processing.')
|
||||||
|
|
||||||
parser.add_argument('--time',
|
parser.add_argument('--time',
|
||||||
action=StoreTrue,
|
action=StoreTrue,
|
||||||
|
|
|
@ -451,7 +451,7 @@ def get_submodel_argv(args, submodels_path = None, submodel_name = None):
|
||||||
reading the contents of --cameras
|
reading the contents of --cameras
|
||||||
"""
|
"""
|
||||||
assure_always = ['orthophoto_cutline', 'dem_euclidean_map', 'skip_3dmodel', 'skip_report']
|
assure_always = ['orthophoto_cutline', 'dem_euclidean_map', 'skip_3dmodel', 'skip_report']
|
||||||
remove_always = ['split', 'split_overlap', 'rerun_from', 'rerun', 'gcp', 'end_with', 'sm_cluster', 'rerun_all', 'pc_csv', 'pc_las', 'pc_ept', 'tiles']
|
remove_always = ['split', 'split_overlap', 'rerun_from', 'rerun', 'gcp', 'end_with', 'sm_cluster', 'rerun_all', 'pc_csv', 'pc_las', 'pc_ept', 'tiles', 'copy-to']
|
||||||
read_json_always = ['cameras']
|
read_json_always = ['cameras']
|
||||||
|
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os, shutil
|
||||||
from opendm import log
|
from opendm import log
|
||||||
from opendm.photo import find_largest_photo_dim
|
from opendm.photo import find_largest_photo_dim
|
||||||
from osgeo import gdal
|
from osgeo import gdal
|
||||||
|
@ -51,4 +52,44 @@ def double_quote(s):
|
||||||
|
|
||||||
# use double quotes, and prefix double quotes with a \
|
# use double quotes, and prefix double quotes with a \
|
||||||
# the string $"b is then quoted as "$\"b"
|
# the string $"b is then quoted as "$\"b"
|
||||||
return '"' + s.replace('"', '\\\"') + '"'
|
return '"' + s.replace('"', '\\\"') + '"'
|
||||||
|
|
||||||
|
def get_processing_results_paths():
|
||||||
|
return [
|
||||||
|
"odm_georeferencing",
|
||||||
|
"odm_orthophoto",
|
||||||
|
"odm_dem",
|
||||||
|
"odm_report",
|
||||||
|
"odm_texturing",
|
||||||
|
"entwine_pointcloud",
|
||||||
|
"dsm_tiles",
|
||||||
|
"dtm_tiles",
|
||||||
|
"orthophoto_tiles",
|
||||||
|
"images.json",
|
||||||
|
"cameras.json",
|
||||||
|
]
|
||||||
|
|
||||||
|
def copy_paths(paths, destination, rerun):
|
||||||
|
if not os.path.isdir(destination):
|
||||||
|
os.makedirs(destination)
|
||||||
|
|
||||||
|
for p in paths:
|
||||||
|
basename = os.path.basename(p)
|
||||||
|
dst_path = os.path.join(destination, basename)
|
||||||
|
|
||||||
|
if rerun:
|
||||||
|
try:
|
||||||
|
if os.path.isfile(dst_path) or os.path.islink(dst_path):
|
||||||
|
os.remove(dst_path)
|
||||||
|
elif os.path.isdir(dst_path):
|
||||||
|
shutil.rmtree(dst_path)
|
||||||
|
except Exception as e:
|
||||||
|
log.ODM_WARNING("Cannot remove file %s: %s, skipping..." % (dst_path, str(e)))
|
||||||
|
|
||||||
|
if not os.path.exists(dst_path):
|
||||||
|
if os.path.isfile(p):
|
||||||
|
log.ODM_INFO("Copying %s --> %s" % (p, dst_path))
|
||||||
|
shutil.copy(p, dst_path)
|
||||||
|
elif os.path.isdir(p):
|
||||||
|
shutil.copytree(p, dst_path)
|
||||||
|
log.ODM_INFO("Copying %s --> %s" % (p, dst_path))
|
||||||
|
|
13
run.py
13
run.py
|
@ -11,7 +11,7 @@ from opendm import config
|
||||||
from opendm import system
|
from opendm import system
|
||||||
from opendm import io
|
from opendm import io
|
||||||
from opendm.progress import progressbc
|
from opendm.progress import progressbc
|
||||||
from opendm.utils import double_quote
|
from opendm.utils import double_quote, get_processing_results_paths
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -49,18 +49,11 @@ if __name__ == '__main__':
|
||||||
if args.rerun_all:
|
if args.rerun_all:
|
||||||
log.ODM_INFO("Rerun all -- Removing old data")
|
log.ODM_INFO("Rerun all -- Removing old data")
|
||||||
os.system("rm -rf " +
|
os.system("rm -rf " +
|
||||||
" ".join([
|
" ".join([double_quote(os.path.join(args.project_path, p)) for p in get_processing_results_paths()] + [
|
||||||
double_quote(os.path.join(args.project_path, "odm_georeferencing")),
|
|
||||||
double_quote(os.path.join(args.project_path, "odm_meshing")),
|
double_quote(os.path.join(args.project_path, "odm_meshing")),
|
||||||
double_quote(os.path.join(args.project_path, "odm_orthophoto")),
|
|
||||||
double_quote(os.path.join(args.project_path, "odm_dem")),
|
|
||||||
double_quote(os.path.join(args.project_path, "odm_report")),
|
|
||||||
double_quote(os.path.join(args.project_path, "odm_texturing")),
|
|
||||||
double_quote(os.path.join(args.project_path, "opensfm")),
|
double_quote(os.path.join(args.project_path, "opensfm")),
|
||||||
double_quote(os.path.join(args.project_path, "odm_filterpoints")),
|
|
||||||
double_quote(os.path.join(args.project_path, "odm_texturing_25d")),
|
double_quote(os.path.join(args.project_path, "odm_texturing_25d")),
|
||||||
double_quote(os.path.join(args.project_path, "openmvs")),
|
double_quote(os.path.join(args.project_path, "odm_filterpoints")),
|
||||||
double_quote(os.path.join(args.project_path, "entwine_pointcloud")),
|
|
||||||
double_quote(os.path.join(args.project_path, "submodels")),
|
double_quote(os.path.join(args.project_path, "submodels")),
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ architectures:
|
||||||
- build-on: amd64
|
- build-on: amd64
|
||||||
run-on: amd64
|
run-on: amd64
|
||||||
|
|
||||||
# Requires snapcraft to be called with --enable-experimental-package-repositories
|
|
||||||
# until the feature is released
|
|
||||||
package-repositories:
|
package-repositories:
|
||||||
- type: apt
|
- type: apt
|
||||||
ppa: ubuntugis/ubuntugis-unstable
|
ppa: ubuntugis/ubuntugis-unstable
|
||||||
|
|
|
@ -14,7 +14,7 @@ from opendm.point_cloud import export_info_json
|
||||||
from opendm.cropper import Cropper
|
from opendm.cropper import Cropper
|
||||||
from opendm.orthophoto import get_orthophoto_vars, get_max_memory, generate_png
|
from opendm.orthophoto import get_orthophoto_vars, get_max_memory, generate_png
|
||||||
from opendm.tiles.tiler import generate_colored_hillshade
|
from opendm.tiles.tiler import generate_colored_hillshade
|
||||||
from opendm.utils import get_raster_stats
|
from opendm.utils import get_raster_stats, copy_paths, get_processing_results_paths
|
||||||
|
|
||||||
def hms(seconds):
|
def hms(seconds):
|
||||||
h = seconds // 3600
|
h = seconds // 3600
|
||||||
|
@ -195,4 +195,11 @@ class ODMReport(types.ODM_Stage):
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING("Cannot generate overlap diagram, point cloud stats missing")
|
log.ODM_WARNING("Cannot generate overlap diagram, point cloud stats missing")
|
||||||
|
|
||||||
octx.export_report(os.path.join(tree.odm_report, "report.pdf"), odm_stats, self.rerun())
|
octx.export_report(os.path.join(tree.odm_report, "report.pdf"), odm_stats, self.rerun())
|
||||||
|
|
||||||
|
# TODO: does this warrant a new stage?
|
||||||
|
if args.copy_to:
|
||||||
|
try:
|
||||||
|
copy_paths([os.path.join(args.project_path, p) for p in get_processing_results_paths()], args.copy_to, self.rerun())
|
||||||
|
except Exception as e:
|
||||||
|
log.ODM_WARNING("Cannot copy to %s: %s" % (args.copy_to, str(e)))
|
||||||
|
|
Ładowanie…
Reference in New Issue