From ecdf71d14d7d5bd92c7bc113cb693efe5894c9b2 Mon Sep 17 00:00:00 2001 From: Korijn van Golen Date: Mon, 15 Jun 2015 15:41:18 +0200 Subject: [PATCH] Switched to memory view syntax. --- skimage/feature/_hoghistogram.pyx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/skimage/feature/_hoghistogram.pyx b/skimage/feature/_hoghistogram.pyx index 5e181058e09..d6d9732d315 100644 --- a/skimage/feature/_hoghistogram.pyx +++ b/skimage/feature/_hoghistogram.pyx @@ -5,9 +5,8 @@ import numpy as np cimport numpy as cnp -# cnp.float64_t[:, :] magnitude -cdef float CellHog(cnp.ndarray[cnp.float64_t, ndim=2] magnitude, - cnp.ndarray[cnp.float64_t, ndim=2] orientation, +cdef float CellHog(cnp.float64_t[:, :] magnitude, + cnp.float64_t[:, :] orientation, float ori1, float ori2, int cx, int cy, int xi, int yi, int sx, int sy): """CellHog @@ -56,13 +55,13 @@ cdef float CellHog(cnp.ndarray[cnp.float64_t, ndim=2] magnitude, return total -def HogHistograms(cnp.ndarray[cnp.float64_t, ndim=2] gx, - cnp.ndarray[cnp.float64_t, ndim=2] gy, +def HogHistograms(cnp.float64_t[:, :] gx, + cnp.float64_t[:, :] gy, int cx, int cy, int sx, int sy, int n_cellsx, int n_cellsy, int visualise, int orientations, - cnp.ndarray[cnp.float64_t, ndim=3] orientation_histogram): + cnp.float64_t[:, :, :] orientation_histogram): """Extract Histogram of Oriented Gradients (HOG) for a given image. Parameters @@ -91,9 +90,8 @@ def HogHistograms(cnp.ndarray[cnp.float64_t, ndim=2] gx, The histogram to fill. """ - cdef cnp.ndarray[cnp.float64_t, ndim=2] magnitude = np.hypot(gx, gy) - cdef cnp.ndarray[cnp.float64_t, ndim=2] orientation = ( - np.arctan2(gy, gx) * (180 / np.pi) % 180) + cdef cnp.float64_t[:, :] magnitude = np.hypot(gx, gy) + cdef cnp.float64_t[:, :] orientation = np.arctan2(gy, gx) * (180 / np.pi) % 180 cdef int i, x, y, o, yi, xi, cy1, cy2, cx1, cx2 cdef float ori1, ori2