kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
ec6ed4b625
commit
e46cac88bb
|
@ -315,6 +315,29 @@ def config():
|
|||
help=('Orthophoto ground resolution in pixels/meter'
|
||||
'Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--orthophoto-target-srs',
|
||||
metavar="<EPSG:XXXX>",
|
||||
type=str,
|
||||
default=None,
|
||||
help='Target spatial reference for orthophoto creation. '
|
||||
'Not implemented yet.\n'
|
||||
'Default: %(default)s')
|
||||
|
||||
parser.add_argument('--orthophoto-no-tiled',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Set this parameter if you want a stripped geoTIFF.\n'
|
||||
'Default: %(default)s')
|
||||
|
||||
parser.add_argument('--orthophoto-compression',
|
||||
metavar='<STRING>',
|
||||
type=str,
|
||||
choices=['JPEG','LZW','PACKBITS','DEFLATE','LZMA','NONE'],
|
||||
default='DEFLATE',
|
||||
help='Set the compression to use. Note that this could '
|
||||
'break gdal_translate if you don\'t know what you '
|
||||
'are doing. Options: %(choices)s.\nDefault: %(default)s')
|
||||
|
||||
parser.add_argument('--zip-results',
|
||||
action='store_true',
|
||||
default=defaultSettings['zip_results'],
|
||||
|
|
|
@ -73,6 +73,9 @@ class ODMApp(ecto.BlackBox):
|
|||
use_exif=p.args.use_exif,
|
||||
verbose=p.args.verbose),
|
||||
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
|
||||
t_srs=p.args.orthophoto_target_srs,
|
||||
no_tiled=p.args.orthophoto_no_tiled,
|
||||
compress=p.args.orthophoto_compression,
|
||||
verbose=p.args.verbose)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ from opendm import types
|
|||
class ODMOrthoPhotoCell(ecto.Cell):
|
||||
def declare_params(self, params):
|
||||
params.declare("resolution", 'Orthophoto ground resolution in pixels/meter', 20)
|
||||
params.declare("t_srs", 'Target SRS', None)
|
||||
params.declare("no_tiled", 'Do not tile tiff', False)
|
||||
params.declare("compress", 'Compression type', 'DEFLATE')
|
||||
params.declare("verbose", 'print additional messages to console', False)
|
||||
|
||||
def declare_io(self, params, inputs, outputs):
|
||||
|
@ -93,20 +96,26 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
|||
'uly': uly,
|
||||
'lrx': lrx,
|
||||
'lry': lry,
|
||||
'tiled': '' if self.params.no_tiled else '-co TILED=yes ',
|
||||
'compress': self.params.compress,
|
||||
'predictor': '-co PREDICTOR=2 ' if self.params.compress in
|
||||
['LZW', 'DEFLATE'] else '',
|
||||
'epsg': georef.epsg,
|
||||
't_srs': self.params.t_srs or "EPSG:{0}".format(georef.epsg),
|
||||
'png': tree.odm_orthophoto_file,
|
||||
'tiff': tree.odm_orthophoto_tif,
|
||||
'log': tree.odm_orthophoto_tif_log
|
||||
}
|
||||
|
||||
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
|
||||
'-co TILED=yes '
|
||||
'-co COMPRESS=DEFLATE '
|
||||
'-co PREDICTOR=2 '
|
||||
'-co BLOCKXSIZE=512 '
|
||||
'-co BLOCKYSIZE=512 '
|
||||
'-co NUM_THREADS=ALL_CPUS '
|
||||
'-a_srs \"EPSG:{epsg}\" {png} {tiff} > {log}'.format(**kwargs))
|
||||
'{tiled} '
|
||||
'-co COMPRESS={compress} '
|
||||
'{predictor} '
|
||||
'-co BLOCKXSIZE=512 '
|
||||
'-co BLOCKYSIZE=512 '
|
||||
'-co NUM_THREADS=ALL_CPUS '
|
||||
'-a_srs \"EPSG:{epsg}\" '
|
||||
'{png} {tiff} > {log}'.format(**kwargs))
|
||||
geotiffcreated = True
|
||||
if not geotiffcreated:
|
||||
log.ODM_WARNING('No geo-referenced orthophoto created due '
|
||||
|
|
Ładowanie…
Reference in New Issue