mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-08 11:42:39 +08:00
Fix loop ranges of rank filter kernel functions
This commit is contained in:
@@ -29,7 +29,7 @@ cdef inline double _kernel_autolevel(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
if delta > 0:
|
||||
return <double>(max_bin - 1) * (g - imin) / delta
|
||||
else:
|
||||
return imax - imin
|
||||
return 0
|
||||
else:
|
||||
return 0
|
||||
|
||||
@@ -321,7 +321,7 @@ cdef inline double _kernel_otsu(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
mu1 = 0.
|
||||
max_sigma_b = 0.
|
||||
|
||||
for i in range(1, max_bin):
|
||||
for i in range(max_bin):
|
||||
P = histo[i] / pop
|
||||
new_q1 = q1 + P
|
||||
if new_q1 > 0:
|
||||
|
||||
@@ -17,7 +17,7 @@ cdef inline double _kernel_autolevel(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
if pop:
|
||||
sum = 0
|
||||
p1 = 1.0 - p1
|
||||
for i in range(max_bin - 1):
|
||||
for i in range(max_bin):
|
||||
sum += histo[i]
|
||||
if sum > p0 * pop:
|
||||
imin = i
|
||||
@@ -55,7 +55,7 @@ cdef inline double _kernel_gradient(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
imin = i
|
||||
break
|
||||
sum = 0
|
||||
for i in range((max_bin - 1), -1, -1):
|
||||
for i in range(max_bin - 1, -1, -1):
|
||||
sum += histo[i]
|
||||
if sum >= p1 * pop:
|
||||
imax = i
|
||||
@@ -135,7 +135,7 @@ cdef inline double _kernel_enhance_contrast(Py_ssize_t* histo, double pop,
|
||||
imin = i
|
||||
break
|
||||
sum = 0
|
||||
for i in range((max_bin - 1), -1, -1):
|
||||
for i in range(max_bin - 1, -1, -1):
|
||||
sum += histo[i]
|
||||
if sum > p1 * pop:
|
||||
imax = i
|
||||
|
||||
Reference in New Issue
Block a user