kopia lustrzana https://github.com/OpenDroneMap/ODM
Add gdaladdo to build overviews
rodzic
ab72aeafe3
commit
c79c4646df
|
@ -354,6 +354,11 @@ def config():
|
||||||
'https://www.gdal.org/frmt_gtiff.html for more info. '
|
'https://www.gdal.org/frmt_gtiff.html for more info. '
|
||||||
'\nDefault: %(default)s')
|
'\nDefault: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--build-overviews',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Build orthophoto overviews using gdaladdo.')
|
||||||
|
|
||||||
parser.add_argument('--zip-results',
|
parser.add_argument('--zip-results',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
|
|
|
@ -421,3 +421,4 @@ class ODM_Tree(object):
|
||||||
self.odm_orthophoto_corners = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_corners.txt')
|
self.odm_orthophoto_corners = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_corners.txt')
|
||||||
self.odm_orthophoto_log = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_log.txt')
|
self.odm_orthophoto_log = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_log.txt')
|
||||||
self.odm_orthophoto_tif_log = io.join_paths(self.odm_orthophoto, 'gdal_translate_log.txt')
|
self.odm_orthophoto_tif_log = io.join_paths(self.odm_orthophoto, 'gdal_translate_log.txt')
|
||||||
|
self.odm_orthophoto_gdaladdo_log = io.join_paths(self.odm_orthophoto, 'gdaladdo_log.txt')
|
||||||
|
|
|
@ -77,6 +77,7 @@ class ODMApp(ecto.BlackBox):
|
||||||
no_tiled=p.args.orthophoto_no_tiled,
|
no_tiled=p.args.orthophoto_no_tiled,
|
||||||
compress=p.args.orthophoto_compression,
|
compress=p.args.orthophoto_compression,
|
||||||
bigtiff=p.args.orthophoto_bigtiff,
|
bigtiff=p.args.orthophoto_bigtiff,
|
||||||
|
build_overviews=p.args.build_overviews,
|
||||||
verbose=p.args.verbose)
|
verbose=p.args.verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
params.declare("no_tiled", 'Do not tile tiff', False)
|
params.declare("no_tiled", 'Do not tile tiff', False)
|
||||||
params.declare("compress", 'Compression type', 'DEFLATE')
|
params.declare("compress", 'Compression type', 'DEFLATE')
|
||||||
params.declare("bigtiff", 'Make BigTIFF orthophoto', 'IF_SAFER')
|
params.declare("bigtiff", 'Make BigTIFF orthophoto', 'IF_SAFER')
|
||||||
|
params.declare("build_overviews", 'Build overviews', False)
|
||||||
params.declare("verbose", 'print additional messages to console', False)
|
params.declare("verbose", 'print additional messages to console', False)
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
|
@ -119,6 +120,19 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
'-co NUM_THREADS=ALL_CPUS '
|
'-co NUM_THREADS=ALL_CPUS '
|
||||||
'-a_srs \"EPSG:{epsg}\" '
|
'-a_srs \"EPSG:{epsg}\" '
|
||||||
'{png} {tiff} > {log}'.format(**kwargs))
|
'{png} {tiff} > {log}'.format(**kwargs))
|
||||||
|
|
||||||
|
if self.params.build_overviews:
|
||||||
|
log.ODM_DEBUG("Building Overviews")
|
||||||
|
kwargs = {
|
||||||
|
'orthophoto': tree.odm_orthophoto_tif,
|
||||||
|
'log': tree.odm_orthophoto_gdaladdo_log
|
||||||
|
}
|
||||||
|
# Run gdaladdo
|
||||||
|
system.run('gdaladdo -ro -r average '
|
||||||
|
'--config BIGTIFF_OVERVIEW IF_SAFER '
|
||||||
|
'--config COMPRESS_OVERVIEW JPEG '
|
||||||
|
'{orthophoto} 2 4 8 16 > {log}'.format(**kwargs))
|
||||||
|
|
||||||
geotiffcreated = True
|
geotiffcreated = True
|
||||||
if not geotiffcreated:
|
if not geotiffcreated:
|
||||||
log.ODM_WARNING('No geo-referenced orthophoto created due '
|
log.ODM_WARNING('No geo-referenced orthophoto created due '
|
||||||
|
|
Ładowanie…
Reference in New Issue