[python-dtcwt] 115/497: implement Kingsbury keypoint energy function
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:55 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 31f9b2b656b3f3e1698657acfabd4c04c458ff18
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Tue Aug 20 17:22:53 2013 +0100
implement Kingsbury keypoint energy function
---
dtcwt/keypoint.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dtcwt/keypoint.py b/dtcwt/keypoint.py
index 91437fe..0932a26 100644
--- a/dtcwt/keypoint.py
+++ b/dtcwt/keypoint.py
@@ -4,7 +4,8 @@ from dtcwt.sampling import upsample_highpass, upsample
__all__ = [ 'find_keypoints' ]
-def find_keypoints(highpass_subbands, method=None, alpha=1.0, beta=0.4,
+def find_keypoints(highpass_subbands, method=None,
+ alpha=1.0, beta=0.4, kappa=1.0/6.0,
threshold=None, max_points=None,
upsample_keypoint_energy=None, upsample_subbands=None,
refine_positions=True, skip_levels=1):
@@ -13,6 +14,7 @@ def find_keypoints(highpass_subbands, method=None, alpha=1.0, beta=0.4,
:param method: *(optional)* string specifying which keypoint energy method to use
:param alpha: *(optional)* scale parameter for ``'fauqueur'`` method
:param beta: *(optional)* shape parameter for ``'fauqueur'`` method
+ :param kappa: *(optiona)* suppression parameter for ``'kingsbury'`` method
:param threshold: *(optional)* minimum keypoint energy of returned keypoints
:param max_points: *(optional)* maximum number of keypoints to return
:param upsample_keypoint_energy: is non-None, a string specifying a method used to upscale the keypoint energy map before finding keypoints
@@ -54,7 +56,7 @@ def find_keypoints(highpass_subbands, method=None, alpha=1.0, beta=0.4,
=========== ======================================= ======================
fauqueur Geometric mean of absolute values[1] *alpha*, *beta*
bendale Minimum absolute value[2] none
- kingsbury Cross-product of orthogonal subbands none
+ kingsbury Cross-product of orthogonal subbands *kappa*
gale Gradient of subbands none
=========== ======================================= ======================
@@ -94,7 +96,7 @@ def find_keypoints(highpass_subbands, method=None, alpha=1.0, beta=0.4,
elif method == 'bendale':
kp_energies.append(_keypoint_energy_bendale(subband))
elif method == 'kingsbury':
- kp_energies.append(_keypoint_energy_kingsbury(subband))
+ kp_energies.append(_keypoint_energy_kingsbury(subband, kappa))
elif method == 'gale':
kp_energies.append(_keypoint_energy_gale(subband))
else:
@@ -140,8 +142,14 @@ def _keypoint_energy_fauqueur(subband, alpha, beta):
def _keypoint_energy_bendale(subband):
return np.min(np.abs(subband), axis=2)
-def _keypoint_energy_kingsbury(subband):
- raise NotImplementedError('not implemented yet')
+def _keypoint_energy_kingsbury(subband, kappa=1.0/6.0, epsilon=1e-8):
+ abs_Y = np.abs(subband)
+ A = np.sqrt(np.sum(abs_Y*abs_Y, axis=2))
+ B = np.sum(abs_Y[:,:,:3] * abs_Y[:,:,3:], axis=2)
+
+ # The max(0, ...) is not part of the original energy calculation but we use
+ # it to avoid finding false maxima in no-threshold cases.
+ return np.maximum(0, B/np.maximum(epsilon, A) - kappa*A)
def _keypoint_energy_gale(subband):
raise NotImplementedError('not implemented yet')
--
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