[python-dtcwt] 330/497: tweak exactly which levels are used in estimatereg by default
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.
commit f25288ad80d8eb58dac7778855de20730ba04ef0
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Thu Feb 6 17:52:09 2014 +0000
tweak exactly which levels are used in estimatereg by default
---
dtcwt/registration/numpybackend.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dtcwt/registration/numpybackend.py b/dtcwt/registration/numpybackend.py
index f5ccb1b..9c58bce 100644
--- a/dtcwt/registration/numpybackend.py
+++ b/dtcwt/registration/numpybackend.py
@@ -267,7 +267,7 @@ def warptransform(t, avecs, levels, method=None):
# Clone the transform
return backend_numpy.TransformDomainSignal(t.lowpass, tuple(warped_subbands), t.scales)
-def estimatereg(source, reference):
+def estimatereg(source, reference, regshape=None):
"""
Estimate registration from which will map *source* to *reference*.
@@ -287,7 +287,10 @@ def estimatereg(source, reference):
"""
# Extract number of levels and shape of level 3 subband
nlevels = len(source.subbands)
- avecs_shape = source.subbands[2].shape[:2] + (6,)
+ if regshape is None:
+ avecs_shape = source.subbands[2].shape[:2] + (6,)
+ else:
+ avecs_shape = tuple(regshape[:2]) + (6,)
# Initialise matrix of 'a' vectors
avecs = np.zeros(avecs_shape)
@@ -302,9 +305,10 @@ def estimatereg(source, reference):
avecs[:,:,idx] = a[idx]
# Refine estimate
- for it in xrange(2 * (nlevels-3) - 1):
- s, e = nlevels - 2, nlevels - 2 - (it+1)//2
- levels = list(x for x in xrange(s, e-1, -1) if x>=2 and x<nlevels)
+ for it in xrange(2 * (nlevels - 1)):
+ s, e = nlevels, nlevels - 1 - it//2
+ levels = list(x for x in xrange(s, e-1, -1)
+ if x>=2 and x<nlevels and source.subbands[x].shape[0] <= 2*avecs.shape[0] and source.subbands[x].shape[1] <= 2*avecs.shape[1])
if len(levels) == 0:
continue
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git
More information about the debian-science-commits
mailing list