[python-dtcwt] 233/497: registration: added non-highpass sampling functions
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:09 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 7f13493e4049cae9ad00b9ba878257e657a1d247
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Fri Jan 24 15:58:52 2014 +0000
registration: added non-highpass sampling functions
---
dtcwt/registration.py | 44 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 41 insertions(+), 3 deletions(-)
diff --git a/dtcwt/registration.py b/dtcwt/registration.py
index e9ce82c..b823c88 100644
--- a/dtcwt/registration.py
+++ b/dtcwt/registration.py
@@ -18,10 +18,12 @@ __all__ = [
'EXPECTED_SHIFTS',
'affinewarphighpass',
+ 'affinewarp',
'confidence',
'phasegradient',
'qtildematrices',
- 'samplehighpass',
+ 'normsamplehighpass',
+ 'normsample',
'solvetransform',
'velocityfield',
]
@@ -156,7 +158,7 @@ def solvetransform(Qtilde):
q = Qtilde[-1,:-1]
return -np.linalg.inv(Q).dot(q)
-def samplehighpass(Yh, xs, ys, method=None):
+def normsamplehighpass(Yh, xs, ys, method=None):
"""
Given a NxMx6 array of subband responses, sample from co-ordinates *xs* and
*ys*.
@@ -168,6 +170,17 @@ def samplehighpass(Yh, xs, ys, method=None):
"""
return dtcwt.sampling.sample_highpass(Yh, xs*Yh.shape[1], ys*Yh.shape[0], method=method)
+def normsample(Yh, xs, ys, method=None):
+ """
+ Given a NxM image sample from co-ordinates *xs* and *ys*.
+
+ .. note::
+ The sample co-ordinates are in *normalised* co-ordinates such that the
+ image width and height are both unity.
+
+ """
+ return dtcwt.sampling.sample(Yh, xs*Yh.shape[1], ys*Yh.shape[0], method=method)
+
def velocityfield(a, xs, ys):
r"""
Evaluate the velocity field parametrised by *a* at *xs* and *ys*.
@@ -208,4 +221,29 @@ def affinewarphighpass(Yh, a, method=None):
"""
xs, ys = np.meshgrid(np.arange(0,1,1/Yh.shape[1]), np.arange(0,1,1/Yh.shape[0]))
vxs, vys = velocityfield(a, xs, ys)
- return samplehighpass(Yh, xs+vxs, ys+vys, method=method)
+ return normsamplehighpass(Yh, xs+vxs, ys+vys, method=method)
+
+def affinewarp(Yh, a, method=None):
+ r"""
+ Given a NxM image, warp it according to affine transform parametrised by
+ the vector *a* s.t. the pixel at (x,y) samples from (x',y') where
+
+ .. math::
+ [x', y']^T = \mathbf{T} \ [1, x, y]^T
+
+ and
+
+ .. math::
+ \mathbf{T} = \begin{bmatrix}
+ a_0 & a_2 & a_4 \\
+ a_1 & a_3 & a_5
+ \end{bmatrix}
+
+ .. note::
+ The sample co-ordinates are in *normalised* co-ordinates such that the
+ image width and height are both unity.
+
+ """
+ xs, ys = np.meshgrid(np.arange(0,1,1/Yh.shape[1]), np.arange(0,1,1/Yh.shape[0]))
+ vxs, vys = velocityfield(a, xs, ys)
+ return normsample(Yh, xs+vxs, ys+vys, method=method)
--
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