mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-26 13:37:17 +08:00
Fix rank filter kernels
This commit is contained in:
@@ -26,7 +26,7 @@ cdef inline void _kernel_mean(dtype_t_out* out, Py_ssize_t odepth,
|
||||
bilat_pop += histo[i]
|
||||
mean += histo[i] * i
|
||||
if bilat_pop:
|
||||
out[0] = <dtype_t_out>mean / bilat_pop
|
||||
out[0] = <dtype_t_out>(mean / bilat_pop)
|
||||
else:
|
||||
out[0] = <dtype_t_out>0
|
||||
else:
|
||||
|
||||
@@ -29,7 +29,7 @@ cdef inline void _kernel_autolevel(dtype_t_out* out, Py_ssize_t odepth,
|
||||
break
|
||||
delta = imax - imin
|
||||
if delta > 0:
|
||||
out[0] = <dtype_t_out>(max_bin - 1) * (g - imin) / delta
|
||||
out[0] = <dtype_t_out>((max_bin - 1) * (g - imin) / delta)
|
||||
else:
|
||||
out[0] = <dtype_t_out>0
|
||||
else:
|
||||
@@ -49,7 +49,7 @@ cdef inline void _kernel_bottomhat(dtype_t_out* out, Py_ssize_t odepth,
|
||||
for i in range(max_bin):
|
||||
if histo[i]:
|
||||
break
|
||||
out[0] = <dtype_t_out>g - i
|
||||
out[0] = <dtype_t_out>(g - i)
|
||||
else:
|
||||
out[0] = <dtype_t_out>0
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ cdef inline void _kernel_sum(dtype_t_out* out, Py_ssize_t odepth,
|
||||
sum_g += histo[i] * i
|
||||
|
||||
if n > 0:
|
||||
out[0] = <dtype_t_out>(sum_g)
|
||||
out[0] = <dtype_t_out>sum_g
|
||||
else:
|
||||
out[0] = <dtype_t_out>0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user