Commit 7a891c26 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

changed handling of 'ignore_errors' keyword of COREG_LOCAL

components.CoReg_local.COREG_LOCAL:
- __init__(): changed handling of 'ignore_errors' keyword

components.Geom_Quality_Grid.Tie_Point_Refiner:
- _RANSAC_outlier_detection(): revised assertion

- updated __version__
parent 48958403
......@@ -9,7 +9,7 @@ from .components import utilities
from .components import geometry
__author__ = 'Daniel Scheffler'
__version__= '2017-02-03_01'
__version__= '2017-02-08_01'
__all__=['COREG',
'COREG_LOCAL',
......
......@@ -34,7 +34,7 @@ class COREG_LOCAL(object):
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=False):
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
......@@ -163,7 +163,7 @@ class COREG_LOCAL(object):
self.v = v
self.q = q if not v else False # overridden by v
self.progress = progress if not q else False # overridden by v
self.ignErr = ignore_errors
self.ignErr = ignore_errors # FIXME this is not yet implemented for COREG_LOCAL
assert self.tieP_filter_level in range(4), 'Invalid tie point filter level.'
assert isinstance(self.imref, GeoArray) and isinstance(self.im2shift, GeoArray), \
......@@ -197,7 +197,7 @@ class COREG_LOCAL(object):
progress = self.progress,
v = v,
q = q,
ignore_errors = self.ignErr)
ignore_errors = False) # must be False because COREG init fails, coregistration for the whole scene fails
except Exception as err:
raise RuntimeError('First attempt to check if functionality of co-registration failed. Check your '
'input data and parameters. The following error occurred: ', repr(err))
......
......@@ -635,6 +635,7 @@ class TiePoint_Refiner(object):
:return:
"""
# exclude previous outliers
GDF = self.GDF[self.GDF[self.new_cols].any(axis=1)==False].copy() if exclude_previous_outliers else self.GDF
src_coords = np.array(GDF[['X_UTM', 'Y_UTM']])
......@@ -644,7 +645,7 @@ class TiePoint_Refiner(object):
for co, n in zip([src_coords, est_coords], ['src_coords', 'est_coords']):
assert co.ndim==2 and co.shape[1]==2, "'%s' must have shape [Nx2]. Got shape %s."%(n, co.shape)
if max_outlier_percentage >100: raise ValueError
if not 0 < max_outlier_percentage < 100: raise ValueError
min_inlier_percentage = 100-max_outlier_percentage
class PolyTF_1(PolynomialTransform):
......@@ -652,7 +653,7 @@ class TiePoint_Refiner(object):
return PolynomialTransform.estimate(*data, order=1)
# robustly estimate affine transform model with RANSAC
# exliminates not more than the given maximum outlier percentage of the tie points
# eliminates not more than the given maximum outlier percentage of the tie points
model_robust, inliers = None, None
count_inliers = None
......
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