Commit a201053a authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfixes

components.CoReg_local.COREG_LOCAL:
- refactored quality_grid to tiepoint_grid and _quality_grid to _tiepoint_grid
- coreg_info: bugfix for wrong value of 'reference geotransform'

components.Tie_Point_Grid:
- Tie_Point_Grid:
    - _get_imXY__mapXY_points(): fix for unequal shapes of XY_points and XY_mapPoints in case of float coordinates
- Tie_Point_Refiner:
    - run_filtering(): fix for not appending 'L3_OUTLIER' to list of new columns

- updated __version__
parent fedaae86
......@@ -9,7 +9,7 @@ from .components import utilities
from .components import geometry
__author__ = 'Daniel Scheffler'
__version__= '2017-02-23_01'
__version__= '2017-03-06_01'
__all__=['COREG',
'COREG_LOCAL',
......
......@@ -213,7 +213,7 @@ class COREG_LOCAL(object):
if mask_baddata_ref is not None: self.COREG_obj.ref .mask_baddata = mask_baddata_ref
if mask_baddata_tgt is not None: self.COREG_obj.shift.mask_baddata = mask_baddata_tgt
self._quality_grid = None # set by self.quality_grid
self._tiepoint_grid = None # set by self.quality_grid
self._CoRegPoints_table = None # set by self.CoRegPoints_table
self._coreg_info = None # set by self.coreg_info
self.deshift_results = None # set by self.correct_shifts()
......@@ -256,11 +256,11 @@ class COREG_LOCAL(object):
@property
def quality_grid(self):
if self._quality_grid:
return self._quality_grid
def tiepoint_grid(self):
if self._tiepoint_grid:
return self._tiepoint_grid
else:
self._quality_grid = Tie_Point_Grid(self.COREG_obj, self.grid_res,
self._tiepoint_grid = Tie_Point_Grid(self.COREG_obj, self.grid_res,
max_points = self.max_points,
outFillVal = self.outFillVal,
resamp_alg_calc = self.rspAlg_calc,
......@@ -273,7 +273,7 @@ class COREG_LOCAL(object):
if self.v:
print('Visualizing CoReg points grid...')
self.view_CoRegPoints(figsize=(10,10))
return self._quality_grid
return self._tiepoint_grid
@property
......@@ -282,12 +282,12 @@ class COREG_LOCAL(object):
'Y_WIN_SIZE','X_SHIFT_PX','Y_SHIFT_PX', 'X_SHIFT_M', 'Y_SHIFT_M', 'ABS_SHIFT' and 'ANGLE' containing all
information containing all the results frm coregistration for all points in the geometric quality grid.
"""
return self.quality_grid.CoRegPoints_table
return self.tiepoint_grid.CoRegPoints_table
@property
def success(self):
self._success = self.quality_grid.GCPList != []
self._success = self.tiepoint_grid.GCPList != []
if not self._success and not self.q:
warnings.warn('No valid GCPs could by identified.')
return self._success
......@@ -447,9 +447,9 @@ class COREG_LOCAL(object):
return self._coreg_info
else:
self._coreg_info = {
'GCPList' : self.quality_grid.GCPList,
'GCPList' : self.tiepoint_grid.GCPList,
'reference projection' : self.imref.prj,
'reference geotransform': self.im2shift.gt,
'reference geotransform': self.imref.gt,
'reference grid' : [ [self.imref.gt[0], self.imref.gt[0]+self.imref.gt[1]],
[self.imref.gt[3], self.imref.gt[3]+self.imref.gt[5]] ],
'reference extent' : {'cols':self.imref.xgsd, 'rows':self.imref.ygsd}, # FIXME not needed anymore
......@@ -469,7 +469,7 @@ class COREG_LOCAL(object):
coreg_info = self.coreg_info
if self.quality_grid.GCPList:
if self.tiepoint_grid.GCPList:
if max_GCP_count:
coreg_info['GCPList'] = coreg_info['GCPList'][:max_GCP_count]
......
......@@ -144,10 +144,8 @@ class Tie_Point_Grid(object):
Xarr,Yarr = np.meshgrid(np.arange(0,self.shift.shape[1],grid_res),
np.arange(0,self.shift.shape[0],grid_res))
ULmapYX, URmapYX, LRmapYX, LLmapYX = self.shift.box.boxMapYX
mapXarr,mapYarr = np.meshgrid(np.arange(ULmapYX[1],LRmapYX[1], self.grid_res*self.COREG_obj.shift.xgsd),
np.arange(ULmapYX[0],LRmapYX[0],-abs(self.grid_res*self.COREG_obj.shift.ygsd)))
mapXarr = np.full_like(Xarr, self.shift.gt[0], dtype=np.float64) + Xarr*self.shift.gt[1]
mapYarr = np.full_like(Yarr, self.shift.gt[3], dtype=np.float64) - Yarr*abs(self.shift.gt[5])
XY_points = np.empty((Xarr.size,2),Xarr.dtype)
XY_points[:,0] = Xarr.flat
......@@ -157,6 +155,8 @@ class Tie_Point_Grid(object):
XY_mapPoints[:,0] = mapXarr.flat
XY_mapPoints[:,1] = mapYarr.flat
assert XY_points.shape == XY_mapPoints.shape
return XY_points,XY_mapPoints
......@@ -604,7 +604,6 @@ class Tie_Point_Refiner(object):
if len(self.GDF)>4:
# running RANSAC with less than four tie points makes no sense
self.GDF['L3_OUTLIER'] = marked_recs.tolist() # we need to join a list here because otherwise it's merged by the 'index' column
self.new_cols.append('L3_OUTLIER')
if not self.q:
print(
'%s tie points flagged by level 3 filtering (RANSAC)' % (len(marked_recs[marked_recs == True])))
......@@ -612,6 +611,8 @@ class Tie_Point_Refiner(object):
print('RANSAC skipped because too less valid tie points have been found.')
self.GDF['L3_OUTLIER'] = False
self.new_cols.append('L3_OUTLIER')
self.GDF['OUTLIER'] = self.GDF[self.new_cols].any(axis=1)
self.new_cols.append('OUTLIER')
......
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