mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
rename egalise to equalize
This commit is contained in:
@@ -19,7 +19,7 @@ to be adjusted...
|
||||
from skimage import data
|
||||
from skimage.util.dtype import dtype_range
|
||||
from skimage import exposure
|
||||
from skimage.rank import egalise
|
||||
from skimage import rank
|
||||
from skimage.morphology import disk
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ img_rescale = exposure.equalize(img)
|
||||
|
||||
# Equalization
|
||||
selem = disk(30)
|
||||
img_eq = egalise(img,selem=selem)
|
||||
img_eq = rank.equalize(img,selem=selem)
|
||||
|
||||
|
||||
# Display results
|
||||
|
||||
@@ -49,7 +49,7 @@ cdef inline np.uint8_t kernel_bottomhat(int* histo, float pop, np.uint8_t g):
|
||||
return <np.uint8_t>(g-i)
|
||||
|
||||
|
||||
cdef inline np.uint8_t kernel_egalise(int* histo, float pop, np.uint8_t g):
|
||||
cdef inline np.uint8_t kernel_equalize(int* histo, float pop, np.uint8_t g):
|
||||
cdef int i
|
||||
cdef float sum = 0.
|
||||
|
||||
@@ -210,14 +210,14 @@ def bottomhat(np.ndarray[np.uint8_t, ndim=2] image,
|
||||
"""
|
||||
return _core8(kernel_bottomhat,image,selem,mask,out,shift_x,shift_y)
|
||||
|
||||
def egalise(np.ndarray[np.uint8_t, ndim=2] image,
|
||||
def equalize(np.ndarray[np.uint8_t, ndim=2] image,
|
||||
np.ndarray[np.uint8_t, ndim=2] selem,
|
||||
np.ndarray[np.uint8_t, ndim=2] mask=None,
|
||||
np.ndarray[np.uint8_t, ndim=2] out=None,
|
||||
char shift_x=0, char shift_y=0):
|
||||
"""local egalisation of the gray level
|
||||
"""
|
||||
return _core8(kernel_egalise,image,selem,mask,out,shift_x,shift_y)
|
||||
return _core8(kernel_equalize,image,selem,mask,out,shift_x,shift_y)
|
||||
|
||||
def gradient(np.ndarray[np.uint8_t, ndim=2] image,
|
||||
np.ndarray[np.uint8_t, ndim=2] selem,
|
||||
|
||||
+10
-10
@@ -18,7 +18,7 @@ import numpy as np
|
||||
from generic import find_bitdepth
|
||||
import _crank16,_crank8
|
||||
|
||||
__all__ = ['autolevel','bottomhat','egalise','gradient','maximum','mean'
|
||||
__all__ = ['autolevel','bottomhat','equalize','gradient','maximum','mean'
|
||||
,'meansubstraction','median','minimum','modal','morph_contr_enh','pop','threshold', 'tophat']
|
||||
|
||||
def autolevel(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
@@ -162,10 +162,10 @@ def bottomhat(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
else:
|
||||
raise TypeError("only uint8 and uint16 image supported!")
|
||||
|
||||
def egalise(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
"""Return greyscale local egalise of an image.
|
||||
def equalize(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
"""Return greyscale local equalize of an image.
|
||||
|
||||
egalise is computed on the given structuring element.
|
||||
equalize is computed on the given structuring element.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -187,8 +187,8 @@ def egalise(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
|
||||
Returns
|
||||
-------
|
||||
local egalise : uint8 array or uint16 array depending on input image
|
||||
The result of the local egalise.
|
||||
local equalize : uint8 array or uint16 array depending on input image
|
||||
The result of the local equalize.
|
||||
|
||||
Examples
|
||||
--------
|
||||
@@ -200,7 +200,7 @@ def egalise(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
... [0, 1, 1, 1, 0],
|
||||
... [0, 1, 1, 1, 0],
|
||||
... [0, 0, 0, 0, 0]], dtype=np.uint8)
|
||||
>>> egalise(ima8, square(3))
|
||||
>>> equalize(ima8, square(3))
|
||||
array([[191, 170, 127, 170, 191],
|
||||
[170, 255, 255, 255, 170],
|
||||
[127, 255, 255, 255, 127],
|
||||
@@ -212,7 +212,7 @@ def egalise(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
... [0, 1, 1, 1, 0],
|
||||
... [0, 1, 1, 1, 0],
|
||||
... [0, 0, 0, 0, 0]], dtype=np.uint16)
|
||||
>>> egalise(ima16, square(3))
|
||||
>>> equalize(ima16, square(3))
|
||||
array([[3072, 2730, 2048, 2730, 3072],
|
||||
[2730, 4096, 4096, 4096, 2730],
|
||||
[2048, 4096, 4096, 4096, 2048],
|
||||
@@ -223,12 +223,12 @@ def egalise(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||
if mask is not None:
|
||||
mask = img_as_ubyte(mask)
|
||||
if image.dtype == np.uint8:
|
||||
return _crank8.egalise(image,selem,shift_x=shift_x,shift_y=shift_y,mask=mask,out=out)
|
||||
return _crank8.equalize(image,selem,shift_x=shift_x,shift_y=shift_y,mask=mask,out=out)
|
||||
elif image.dtype == np.uint16:
|
||||
bitdepth = find_bitdepth(image)
|
||||
if bitdepth>11:
|
||||
raise ValueError("only uint16 <4096 image (12bit) supported!")
|
||||
return _crank16.egalise(image,selem,shift_x=shift_x,shift_y=shift_y,mask=mask,bitdepth=bitdepth+1,out=out)
|
||||
return _crank16.equalize(image,selem,shift_x=shift_x,shift_y=shift_y,mask=mask,bitdepth=bitdepth+1,out=out)
|
||||
else:
|
||||
raise TypeError("only uint8 and uint16 image supported!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user