From 966afc122a2fba6d2ae15db5ff28444679ff9dcf Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sat, 16 Jul 2016 21:03:28 -0500 Subject: [PATCH] Special-case 2D images to maintain x/y instead of r/c --- skimage/feature/corner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skimage/feature/corner.py b/skimage/feature/corner.py index 1dec5e5a..5246ba92 100644 --- a/skimage/feature/corner.py +++ b/skimage/feature/corner.py @@ -158,6 +158,10 @@ def hessian_matrix(image, sigma=1, mode='constant', cval=0): H_elems = [np.gradient(gradients[ax0], axis=ax1) for ax0, ax1 in combinations_with_replacement(axes, 2)] + if image.ndim == 2: + # The legacy 2D code followed (x, y) convention, so we swap the axis + # order to maintain compatibility with old code + H_elems.reverse() return H_elems