Commit 0b5fae40 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfixes

components.CoReg_local.COREG_LOCAL:
- added keyword 'force_quadratic_win'

components.Tie_Point_Grid.Tie_Point_Grid:
- implemented keyword 'force_quadratic_win'

coreg_cmd:
- parameter '-quadratic_win' is now working for global and local approach
- added parameter 'tieP_filter_level' for adjusting tie point filter level

updated __version__
parent 274fe189
......@@ -9,7 +9,7 @@ from .components import utilities
from .components import geometry
__author__ = 'Daniel Scheffler'
__version__= '2017-04-05_01'
__version__= '2017-04-05_02'
__all__=['COREG',
'COREG_LOCAL',
......
......@@ -33,8 +33,8 @@ class COREG_LOCAL(object):
tieP_filter_level=3, align_grids=True, match_gsd=False, out_gsd=None, target_xyGrid=None,
resamp_alg_deshift='cubic', resamp_alg_calc='cubic', footprint_poly_ref=None, footprint_poly_tgt=None,
data_corners_ref=None, data_corners_tgt=None, outFillVal=-9999, nodata=(None, None), calc_corners=True,
binary_ws=True, mask_baddata_ref=None, mask_baddata_tgt=None, CPUs=None, progress=True,
v=False, q=False, ignore_errors=True):
binary_ws=True, force_quadratic_win=True, mask_baddata_ref=None, mask_baddata_tgt=None, CPUs=None,
progress=True, v=False, q=False, ignore_errors=True):
"""Applies the algorithm to detect spatial shifts to the whole overlap area of the input images. Spatial shifts
are calculated for each point in grid of which the parameters can be adjusted using keyword arguments. Shift
......@@ -63,7 +63,7 @@ class COREG_LOCAL(object):
:param s_b4match(int): band of shift image to be used for matching (starts with 1; default: 1)
:param max_iter(int): maximum number of iterations for matching (default: 5)
:param max_shift(int): maximum shift distance in reference image pixel units (default: 5 px)
:param tieP_filter_level(int): filter tie points used for shift correction in different levels (default: 2).
:param tieP_filter_level(int): filter tie points used for shift correction in different levels (default: 3).
NOTE: lower levels are also included if a higher level is chosen
- Level 0: no tie point filtering
- Level 1: Reliablity filtering - filter all tie points out that have a low
......@@ -107,6 +107,7 @@ class COREG_LOCAL(object):
matching window position within the actual image overlap
(default: True; deactivated if 'data_corners_im0' and 'data_corners_im1' are given
:param binary_ws(bool): use binary X/Y dimensions for the matching window (default: True)
:param force_quadratic_win(bool): force a quadratic matching window (default: 1)
:param mask_baddata_ref(str, BadDataMask):
path to a 2D boolean mask file (or an instance of BadDataMask) for the
reference image where all bad data pixels (e.g. clouds) are marked with
......@@ -158,6 +159,7 @@ class COREG_LOCAL(object):
self.nodata = nodata
self.outFillVal = outFillVal
self.bin_ws = binary_ws
self.force_quadratic_win = force_quadratic_win
self.CPUs = CPUs
self.path_verbose_out = '' # TODO
self.v = v
......@@ -195,6 +197,7 @@ class COREG_LOCAL(object):
mask_baddata_ref = None, # see below
mask_baddata_tgt = None,
CPUs = self.CPUs,
force_quadratic_win = self.force_quadratic_win,
binary_ws = self.bin_ws,
progress = self.progress,
v = v,
......
......@@ -286,6 +286,7 @@ class Tie_Point_Grid(object):
max_iter = self.COREG_obj.max_iter,
max_shift = self.COREG_obj.max_shift,
nodata = (self.COREG_obj.ref.nodata, self.COREG_obj.shift.nodata),
force_quadratic_win= self.COREG_obj.force_quadratic_win,
binary_ws = self.COREG_obj.bin_ws,
v = False, # otherwise this would lead to massive console output
q = True, # otherwise this would lead to massive console output
......
......@@ -57,6 +57,7 @@ def run_global_coreg(args):
nodata = args.nodata,
calc_corners = args.calc_cor,
CPUs = None if args.mp else 1,
force_quadratic_win = args.quadratic_win,
binary_ws = args.bin_ws,
mask_baddata_ref = args.mask_ref,
mask_baddata_tgt = args.mask_tgt,
......@@ -80,6 +81,7 @@ def run_local_coreg(args):
window_size = args.ws,
max_iter = args.max_iter,
max_shift = args.max_shift,
tieP_filter_level = args.tieP_filter_level,
#align_grids = args.align_grids,
#match_gsd = args.match_gsd,
#out_gsd = args.out_gsd,
......@@ -90,6 +92,7 @@ def run_local_coreg(args):
mask_baddata_ref = args.mask_ref,
mask_baddata_tgt = args.mask_tgt,
CPUs = None if args.mp else 1,
force_quadratic_win=args.quadratic_win,
binary_ws = args.bin_ws,
progress = args.progress,
v = args.v,
......@@ -165,8 +168,6 @@ if __name__ == '__main__':
gloArg('-fmt_out', nargs='?', type=str, help="raster file format for output file. ignored if path_out is None. can "
"be any GDAL compatible raster file format (e.g. 'ENVI', 'GeoTIFF'; default: ENVI)", default='ENVI')
gloArg('-br', nargs='?', type=int,
help='band of reference image to be used for matching (starts with 1; default: 1)', default=1)
......@@ -286,6 +287,14 @@ if __name__ == '__main__':
locArg('-max_shift', nargs='?', type=int,
help="maximum shift distance in reference image pixel units (default: 5 px)", default=5)
gloArg('-tieP_filter_level', nargs='?', type=int,
help="filter tie points used for shift correction in different levels (default: 3). NOTE: lower levels are "
"also included if a higher level is chosen. Level 0: no tie point filtering; Level 1: Reliablity "
"filtering - filter all tie points out that have a low reliability according to internal tests; "
"Level 2: SSIM filtering - filters all tie points out where shift correction does not increase image "
"similarity within matching window (measured by mean structural similarity index) "
"Level 3: RANSAC outlier detection", default=3, choices=[0, 1, 2, 3])
# TODO implement footprint_poly_ref, footprint_poly_tgt
locArg('-cor0', nargs=8, type=float, help="map coordinates of data corners within reference image: ",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment