mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-30 20:00:37 +08:00
Replace all float dtypes with double
This commit is contained in:
@@ -9,10 +9,10 @@ from libc.math cimport log
|
||||
from .core_cy cimport dtype_t, dtype_t_out, _core
|
||||
|
||||
|
||||
cdef inline float _kernel_mean(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_mean(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t bilat_pop = 0
|
||||
@@ -31,10 +31,10 @@ cdef inline float _kernel_mean(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_pop(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_pop(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t bilat_pop = 0
|
||||
|
||||
@@ -15,14 +15,14 @@ cdef dtype_t _max(dtype_t a, dtype_t b)
|
||||
cdef dtype_t _min(dtype_t a, dtype_t b)
|
||||
|
||||
|
||||
cdef void _core(float kernel(Py_ssize_t*, float, dtype_t,
|
||||
Py_ssize_t, Py_ssize_t, float,
|
||||
float, Py_ssize_t, Py_ssize_t),
|
||||
cdef void _core(double kernel(Py_ssize_t*, double, dtype_t,
|
||||
Py_ssize_t, Py_ssize_t, double,
|
||||
double, Py_ssize_t, Py_ssize_t),
|
||||
dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y,
|
||||
float p0, float p1,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1,
|
||||
Py_ssize_t max_bin) except *
|
||||
|
||||
@@ -17,13 +17,13 @@ cdef inline dtype_t _min(dtype_t a, dtype_t b):
|
||||
return a if a <= b else b
|
||||
|
||||
|
||||
cdef inline void histogram_increment(Py_ssize_t* histo, float* pop,
|
||||
cdef inline void histogram_increment(Py_ssize_t* histo, double* pop,
|
||||
dtype_t value):
|
||||
histo[value] += 1
|
||||
pop[0] += 1
|
||||
|
||||
|
||||
cdef inline void histogram_decrement(Py_ssize_t* histo, float* pop,
|
||||
cdef inline void histogram_decrement(Py_ssize_t* histo, double* pop,
|
||||
dtype_t value):
|
||||
histo[value] -= 1
|
||||
pop[0] -= 1
|
||||
@@ -42,15 +42,15 @@ cdef inline char is_in_mask(Py_ssize_t rows, Py_ssize_t cols,
|
||||
return 0
|
||||
|
||||
|
||||
cdef void _core(float kernel(Py_ssize_t*, float, dtype_t,
|
||||
Py_ssize_t, Py_ssize_t, float,
|
||||
float, Py_ssize_t, Py_ssize_t),
|
||||
cdef void _core(double kernel(Py_ssize_t*, double, dtype_t,
|
||||
Py_ssize_t, Py_ssize_t, double,
|
||||
double, Py_ssize_t, Py_ssize_t),
|
||||
dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y,
|
||||
float p0, float p1,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1,
|
||||
Py_ssize_t max_bin) except *:
|
||||
"""Compute histogram for each pixel neighborhood, apply kernel function and
|
||||
@@ -82,8 +82,8 @@ cdef void _core(float kernel(Py_ssize_t*, float, dtype_t,
|
||||
# define local variable types
|
||||
cdef Py_ssize_t r, c, rr, cc, s, value, local_max, i, even_row
|
||||
|
||||
# number of pixels actually inside the neighborhood (float)
|
||||
cdef float pop = 0
|
||||
# number of pixels actually inside the neighborhood (double)
|
||||
cdef double pop = 0
|
||||
|
||||
# the current local histogram distribution
|
||||
cdef Py_ssize_t* histo = <Py_ssize_t*>malloc(max_bin * sizeof(Py_ssize_t))
|
||||
|
||||
@@ -9,10 +9,10 @@ from libc.math cimport log
|
||||
from .core_cy cimport dtype_t, dtype_t_out, _core
|
||||
|
||||
|
||||
cdef inline float _kernel_autolevel(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_autolevel(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax, delta
|
||||
|
||||
@@ -27,17 +27,17 @@ cdef inline float _kernel_autolevel(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
break
|
||||
delta = imax - imin
|
||||
if delta > 0:
|
||||
return <float>(max_bin - 1) * (g - imin) / delta
|
||||
return <double>(max_bin - 1) * (g - imin) / delta
|
||||
else:
|
||||
return imax - imin
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_bottomhat(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_bottomhat(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
|
||||
@@ -50,10 +50,10 @@ cdef inline float _kernel_bottomhat(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_equalize(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_equalize(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t sum = 0
|
||||
@@ -68,10 +68,10 @@ cdef inline float _kernel_equalize(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_gradient(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_gradient(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax
|
||||
|
||||
@@ -89,10 +89,10 @@ cdef inline float _kernel_gradient(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_maximum(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_maximum(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
|
||||
@@ -104,10 +104,10 @@ cdef inline float _kernel_maximum(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_mean(Py_ssize_t* histo, float pop,dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_mean(Py_ssize_t* histo, double pop,dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t mean = 0
|
||||
@@ -120,12 +120,12 @@ cdef inline float _kernel_mean(Py_ssize_t* histo, float pop,dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_subtract_mean(Py_ssize_t* histo, float pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, float p0,
|
||||
float p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
cdef inline double _kernel_subtract_mean(Py_ssize_t* histo, double pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, double p0,
|
||||
double p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t mean = 0
|
||||
@@ -138,13 +138,13 @@ cdef inline float _kernel_subtract_mean(Py_ssize_t* histo, float pop,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_median(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_median(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef float sum = pop / 2.0
|
||||
cdef double sum = pop / 2.0
|
||||
|
||||
if pop:
|
||||
for i in range(max_bin):
|
||||
@@ -156,10 +156,10 @@ cdef inline float _kernel_median(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_minimum(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_minimum(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
|
||||
@@ -171,10 +171,10 @@ cdef inline float _kernel_minimum(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_modal(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_modal(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t hmax = 0, imax = 0
|
||||
|
||||
@@ -188,12 +188,12 @@ cdef inline float _kernel_modal(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_enhance_contrast(Py_ssize_t* histo, float pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, float p0,
|
||||
float p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
cdef inline double _kernel_enhance_contrast(Py_ssize_t* histo, double pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, double p0,
|
||||
double p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax
|
||||
|
||||
@@ -214,18 +214,18 @@ cdef inline float _kernel_enhance_contrast(Py_ssize_t* histo, float pop,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_pop(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_pop(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
return pop
|
||||
|
||||
|
||||
cdef inline float _kernel_threshold(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_threshold(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t mean = 0
|
||||
@@ -238,10 +238,10 @@ cdef inline float _kernel_threshold(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_tophat(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_tophat(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
|
||||
@@ -254,10 +254,11 @@ cdef inline float _kernel_tophat(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_noise_filter(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_noise_filter(Py_ssize_t* histo, double pop,
|
||||
dtype_t g, Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, double p0,
|
||||
double p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t min_i
|
||||
@@ -279,12 +280,12 @@ cdef inline float _kernel_noise_filter(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return min_i
|
||||
|
||||
|
||||
cdef inline float _kernel_entropy(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_entropy(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef Py_ssize_t i
|
||||
cdef float e, p
|
||||
cdef double e, p
|
||||
|
||||
if pop:
|
||||
e = 0.
|
||||
@@ -297,14 +298,14 @@ cdef inline float _kernel_entropy(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_otsu(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_otsu(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t max_i
|
||||
cdef float P, mu1, mu2, q1, new_q1, sigma_b, max_sigma_b
|
||||
cdef float mu = 0.
|
||||
cdef double P, mu1, mu2, q1, new_q1, sigma_b, max_sigma_b
|
||||
cdef double mu = 0.
|
||||
|
||||
# compute local mean
|
||||
if pop:
|
||||
|
||||
@@ -7,10 +7,10 @@ cimport numpy as cnp
|
||||
from .core_cy cimport dtype_t, dtype_t_out, _core, _min, _max
|
||||
|
||||
|
||||
cdef inline float _kernel_autolevel(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_autolevel(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax, sum, delta
|
||||
|
||||
@@ -31,7 +31,7 @@ cdef inline float _kernel_autolevel(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
|
||||
delta = imax - imin
|
||||
if delta > 0:
|
||||
return <float>(max_bin - 1) * (_min(_max(imin, g), imax)
|
||||
return <double>(max_bin - 1) * (_min(_max(imin, g), imax)
|
||||
- imin) / delta
|
||||
else:
|
||||
return imax - imin
|
||||
@@ -39,10 +39,10 @@ cdef inline float _kernel_autolevel(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_gradient(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_gradient(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax, sum, delta
|
||||
|
||||
@@ -66,10 +66,10 @@ cdef inline float _kernel_gradient(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_mean(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_mean(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, sum, mean, n
|
||||
|
||||
@@ -91,12 +91,12 @@ cdef inline float _kernel_mean(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_subtract_mean(Py_ssize_t* histo, float pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, float p0,
|
||||
float p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
cdef inline double _kernel_subtract_mean(Py_ssize_t* histo, double pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, double p0,
|
||||
double p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, sum, mean, n
|
||||
|
||||
@@ -117,12 +117,12 @@ cdef inline float _kernel_subtract_mean(Py_ssize_t* histo, float pop,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_enhance_contrast(Py_ssize_t* histo, float pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, float p0,
|
||||
float p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
cdef inline double _kernel_enhance_contrast(Py_ssize_t* histo, double pop,
|
||||
dtype_t g,
|
||||
Py_ssize_t max_bin,
|
||||
Py_ssize_t mid_bin, double p0,
|
||||
double p1, Py_ssize_t s0,
|
||||
Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, imin, imax, sum, delta
|
||||
|
||||
@@ -152,10 +152,10 @@ cdef inline float _kernel_enhance_contrast(Py_ssize_t* histo, float pop,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_percentile(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_percentile(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i
|
||||
cdef Py_ssize_t sum = 0
|
||||
@@ -171,10 +171,10 @@ cdef inline float _kernel_percentile(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_pop(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_pop(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef Py_ssize_t i, sum, n
|
||||
|
||||
@@ -190,10 +190,10 @@ cdef inline float _kernel_pop(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
return 0
|
||||
|
||||
|
||||
cdef inline float _kernel_threshold(Py_ssize_t* histo, float pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
float p0, float p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
cdef inline double _kernel_threshold(Py_ssize_t* histo, double pop, dtype_t g,
|
||||
Py_ssize_t max_bin, Py_ssize_t mid_bin,
|
||||
double p0, double p1,
|
||||
Py_ssize_t s0, Py_ssize_t s1):
|
||||
|
||||
cdef int i
|
||||
cdef Py_ssize_t sum = 0
|
||||
@@ -213,7 +213,7 @@ def _autolevel(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_autolevel[dtype_t], image, selem, mask, out,
|
||||
@@ -224,7 +224,7 @@ def _gradient(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_gradient[dtype_t], image, selem, mask, out,
|
||||
@@ -235,7 +235,7 @@ def _mean(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_mean[dtype_t], image, selem, mask, out,
|
||||
@@ -246,7 +246,7 @@ def _subtract_mean(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_subtract_mean[dtype_t], image, selem, mask,
|
||||
@@ -257,7 +257,7 @@ def _enhance_contrast(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_enhance_contrast[dtype_t], image, selem, mask,
|
||||
@@ -268,7 +268,7 @@ def _percentile(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, Py_ssize_t max_bin):
|
||||
char shift_x, char shift_y, double p0, Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_percentile[dtype_t], image, selem, mask, out,
|
||||
shift_x, shift_y, p0, 1, 0, 0, max_bin)
|
||||
@@ -278,7 +278,7 @@ def _pop(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, float p1,
|
||||
char shift_x, char shift_y, double p0, double p1,
|
||||
Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_pop[dtype_t], image, selem, mask, out,
|
||||
@@ -289,7 +289,7 @@ def _threshold(dtype_t[:, ::1] image,
|
||||
char[:, ::1] selem,
|
||||
char[:, ::1] mask,
|
||||
dtype_t_out[:, ::1] out,
|
||||
char shift_x, char shift_y, float p0, Py_ssize_t max_bin):
|
||||
char shift_x, char shift_y, double p0, Py_ssize_t max_bin):
|
||||
|
||||
_core(_kernel_threshold[dtype_t], image, selem, mask, out,
|
||||
shift_x, shift_y, p0, 1, 0, 0, max_bin)
|
||||
|
||||
Reference in New Issue
Block a user