mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-08 11:26:12 +08:00
Use dynamic pad-width for arbitrary mask shapes
This commit is contained in:
@@ -240,8 +240,6 @@ def corner_orientations(image, Py_ssize_t[:, :] corners, mask):
|
||||
if mask.shape[0] % 2 != 1 or mask.shape[1] % 2 != 1:
|
||||
raise ValueError("Size of mask must be uneven.")
|
||||
|
||||
cdef double[:, :] cimage = pad(image, 16, mode='constant',
|
||||
constant_values=0)
|
||||
cdef char[:, ::1] cmask = np.ascontiguousarray(mask != 0, dtype=np.uint8)
|
||||
|
||||
cdef Py_ssize_t i, r, c, r0, c0
|
||||
@@ -249,13 +247,15 @@ def corner_orientations(image, Py_ssize_t[:, :] corners, mask):
|
||||
cdef Py_ssize_t mcols = mask.shape[1]
|
||||
cdef Py_ssize_t mrows2 = (mrows - 1) / 2
|
||||
cdef Py_ssize_t mcols2 = (mcols - 1) / 2
|
||||
cdef double[:, :] cimage = pad(image, (mrows2, mcols2), mode='constant',
|
||||
constant_values=0)
|
||||
cdef double[:] orientations = np.zeros(corners.shape[0], dtype=np.double)
|
||||
cdef double curr_pixel
|
||||
cdef double m01, m10
|
||||
|
||||
for i in range(corners.shape[0]):
|
||||
r0 = corners[i, 0] - mrows2 + 16
|
||||
c0 = corners[i, 1] - mcols2 + 16
|
||||
r0 = corners[i, 0]
|
||||
c0 = corners[i, 1]
|
||||
|
||||
m01 = 0
|
||||
m10 = 0
|
||||
|
||||
Reference in New Issue
Block a user