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 ...@@ -9,7 +9,7 @@ from .components import utilities
from .components import geometry from .components import geometry
__author__ = 'Daniel Scheffler' __author__ = 'Daniel Scheffler'
__version__= '2017-02-23_01' __version__= '2017-03-06_01'
__all__=['COREG', __all__=['COREG',
'COREG_LOCAL', 'COREG_LOCAL',
......
...@@ -213,7 +213,7 @@ class COREG_LOCAL(object): ...@@ -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_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 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._CoRegPoints_table = None # set by self.CoRegPoints_table
self._coreg_info = None # set by self.coreg_info self._coreg_info = None # set by self.coreg_info
self.deshift_results = None # set by self.correct_shifts() self.deshift_results = None # set by self.correct_shifts()
...@@ -256,24 +256,24 @@ class COREG_LOCAL(object): ...@@ -256,24 +256,24 @@ class COREG_LOCAL(object):
@property @property
def quality_grid(self): def tiepoint_grid(self):
if self._quality_grid: if self._tiepoint_grid:
return self._quality_grid return self._tiepoint_grid
else: 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, max_points = self.max_points,
outFillVal = self.outFillVal, outFillVal = self.outFillVal,
resamp_alg_calc = self.rspAlg_calc, resamp_alg_calc = self.rspAlg_calc,
tieP_filter_level = self.tieP_filter_level, tieP_filter_level = self.tieP_filter_level,
dir_out = self.projectDir, dir_out = self.projectDir,
CPUs = self.CPUs, CPUs = self.CPUs,
progress = self.progress, progress = self.progress,
v = self.v, v = self.v,
q = self.q) q = self.q)
if self.v: if self.v:
print('Visualizing CoReg points grid...') print('Visualizing CoReg points grid...')
self.view_CoRegPoints(figsize=(10,10)) self.view_CoRegPoints(figsize=(10,10))
return self._quality_grid return self._tiepoint_grid
@property @property
...@@ -282,12 +282,12 @@ class COREG_LOCAL(object): ...@@ -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 '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. 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 @property
def success(self): def success(self):
self._success = self.quality_grid.GCPList != [] self._success = self.tiepoint_grid.GCPList != []
if not self._success and not self.q: if not self._success and not self.q:
warnings.warn('No valid GCPs could by identified.') warnings.warn('No valid GCPs could by identified.')
return self._success return self._success
...@@ -447,9 +447,9 @@ class COREG_LOCAL(object): ...@@ -447,9 +447,9 @@ class COREG_LOCAL(object):
return self._coreg_info return self._coreg_info
else: else:
self._coreg_info = { self._coreg_info = {
'GCPList' : self.quality_grid.GCPList, 'GCPList' : self.tiepoint_grid.GCPList,
'reference projection' : self.imref.prj, '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]], '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]] ], [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 'reference extent' : {'cols':self.imref.xgsd, 'rows':self.imref.ygsd}, # FIXME not needed anymore
...@@ -469,7 +469,7 @@ class COREG_LOCAL(object): ...@@ -469,7 +469,7 @@ class COREG_LOCAL(object):
coreg_info = self.coreg_info coreg_info = self.coreg_info
if self.quality_grid.GCPList: if self.tiepoint_grid.GCPList:
if max_GCP_count: if max_GCP_count:
coreg_info['GCPList'] = coreg_info['GCPList'][:max_GCP_count] coreg_info['GCPList'] = coreg_info['GCPList'][:max_GCP_count]
......
...@@ -144,10 +144,8 @@ class Tie_Point_Grid(object): ...@@ -144,10 +144,8 @@ class Tie_Point_Grid(object):
Xarr,Yarr = np.meshgrid(np.arange(0,self.shift.shape[1],grid_res), Xarr,Yarr = np.meshgrid(np.arange(0,self.shift.shape[1],grid_res),
np.arange(0,self.shift.shape[0],grid_res)) np.arange(0,self.shift.shape[0],grid_res))
ULmapYX, URmapYX, LRmapYX, LLmapYX = self.shift.box.boxMapYX 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])
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)))
XY_points = np.empty((Xarr.size,2),Xarr.dtype) XY_points = np.empty((Xarr.size,2),Xarr.dtype)
XY_points[:,0] = Xarr.flat XY_points[:,0] = Xarr.flat
...@@ -157,6 +155,8 @@ class Tie_Point_Grid(object): ...@@ -157,6 +155,8 @@ class Tie_Point_Grid(object):
XY_mapPoints[:,0] = mapXarr.flat XY_mapPoints[:,0] = mapXarr.flat
XY_mapPoints[:,1] = mapYarr.flat XY_mapPoints[:,1] = mapYarr.flat
assert XY_points.shape == XY_mapPoints.shape
return XY_points,XY_mapPoints return XY_points,XY_mapPoints
...@@ -604,7 +604,6 @@ class Tie_Point_Refiner(object): ...@@ -604,7 +604,6 @@ class Tie_Point_Refiner(object):
if len(self.GDF)>4: if len(self.GDF)>4:
# running RANSAC with less than four tie points makes no sense # 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.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: if not self.q:
print( print(
'%s tie points flagged by level 3 filtering (RANSAC)' % (len(marked_recs[marked_recs == True]))) '%s tie points flagged by level 3 filtering (RANSAC)' % (len(marked_recs[marked_recs == True])))
...@@ -612,6 +611,8 @@ class Tie_Point_Refiner(object): ...@@ -612,6 +611,8 @@ class Tie_Point_Refiner(object):
print('RANSAC skipped because too less valid tie points have been found.') print('RANSAC skipped because too less valid tie points have been found.')
self.GDF['L3_OUTLIER'] = False self.GDF['L3_OUTLIER'] = False
self.new_cols.append('L3_OUTLIER')
self.GDF['OUTLIER'] = self.GDF[self.new_cols].any(axis=1) self.GDF['OUTLIER'] = self.GDF[self.new_cols].any(axis=1)
self.new_cols.append('OUTLIER') 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