From 55c77b54df9db06164fbebde937785fdae68ec01 Mon Sep 17 00:00:00 2001 From: Brian Holt Date: Sat, 17 Sep 2011 18:55:41 +0100 Subject: [PATCH] replaced gradient operation with np.diff --- scikits/image/feature/hog.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scikits/image/feature/hog.py b/scikits/image/feature/hog.py index 8d9dc4f7..bdef8d2a 100644 --- a/scikits/image/feature/hog.py +++ b/scikits/image/feature/hog.py @@ -86,14 +86,8 @@ def hog(image, n_orientations=9, pixels_per_cell=(8, 8), gx = np.zeros(image.shape) gy = np.zeros(image.shape) - gx[:-1, :-1] = image[:-1,:-1]-image[:-1,1:] - gy[:-1, :-1] = image[:-1,:-1]-image[1:,:-1] - #gx[:-1, :-1] = np.diff(image, n=1, axis=0) - #gy[:-1, :-1] = np.diff(image, n=1, axis=1) - - #import Image - #Image.fromarray(gx).show() - #Image.fromarray(gy).show() + gx[:, :-1] = np.diff(image, n=1, axis=1) + gy[:-1, :] = np.diff(image, n=1, axis=0) """ The third stage aims to produce an encoding that is sensitive to