renamed adaptive_threshold to threshold_adaptive

This commit is contained in:
Johannes Schönberger
2012-04-25 23:44:06 +02:00
parent d0d71427af
commit aca8522ac4
3 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -4,4 +4,4 @@ from .canny import canny
from .edges import sobel, hsobel, vsobel, hprewitt, vprewitt, prewitt
from .tv_denoise import tv_denoise
from .rank_order import rank_order
from .thresholding import threshold_otsu, adaptive_threshold
from .thresholding import threshold_otsu, threshold_adaptive
+2 -6
View File
@@ -6,12 +6,8 @@ cimport cython
@cython.boundscheck(False)
@cython.wraparound(False)
def _adaptive_threshold(
np.ndarray[np.double_t, ndim=2] image,
int block_size,
double offset,
method
):
def _threshold_adaptive(np.ndarray[np.double_t, ndim=2] image,
int block_size, double offset, method):
cdef int r, c
cdef np.ndarray[np.float64_t, ndim=2] mean_image
if method == 'gaussian':
+4 -4
View File
@@ -1,13 +1,13 @@
import numpy as np
from skimage.exposure import histogram
from ._thresholding import _adaptive_threshold
from ._thresholding import _threshold_adaptive
__all__ = ['threshold_otsu', 'adaptive_threshold']
__all__ = ['threshold_otsu', 'threshold_adaptive']
def adaptive_threshold(image, block_size, offset, method='gaussian'):
def threshold_adaptive(image, block_size, offset, method='gaussian'):
"""Applies an adaptive threshold to an array.
Also known as local or dynamic thresholding where the threshold value is the
@@ -40,7 +40,7 @@ def adaptive_threshold(image, block_size, offset, method='gaussian'):
"""
# not using img_as_float because threshold parameter wouldn't work
image = image.astype('double')
return _adaptive_threshold(image, block_size, offset, method)
return _threshold_adaptive(image, block_size, offset, method)
def threshold_otsu(image, nbins=256):
"""Return threshold value based on Otsu's method.