mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 14:06:55 +08:00
Switched to memory view syntax.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user