mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-25 13:30:51 +08:00
Convert to ubyte dtype explicitly for python 3
This commit is contained in:
@@ -10,10 +10,11 @@ import matplotlib.pyplot as plt
|
||||
from skimage import data
|
||||
from skimage.filter.rank import entropy
|
||||
from skimage.morphology import disk
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
# defining a 8- and a 16-bit test images
|
||||
a8 = data.camera()
|
||||
a8 = img_as_ubyte(data.camera())
|
||||
a16 = a8.astype(np.uint16) * 4
|
||||
|
||||
ent8 = entropy(a8, disk(5)) # pixel value contain 10x the local entropy
|
||||
|
||||
@@ -22,6 +22,7 @@ import matplotlib.pyplot as plt
|
||||
from skimage import data
|
||||
from skimage.color import rgb2hed
|
||||
|
||||
|
||||
ihc_rgb = data.immunohistochemistry()
|
||||
ihc_hed = rgb2hed(ihc_rgb)
|
||||
|
||||
|
||||
@@ -19,15 +19,14 @@ References
|
||||
.. [2] http://en.wikipedia.org/wiki/Adaptive_histogram_equalization
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.util.dtype import dtype_range
|
||||
from skimage.util import img_as_ubyte
|
||||
from skimage import exposure
|
||||
from skimage.morphology import disk
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
import numpy as np
|
||||
from skimage.filter import rank
|
||||
|
||||
|
||||
@@ -58,7 +57,7 @@ def plot_img_and_hist(img, axes, bins=256):
|
||||
|
||||
|
||||
# Load an example image
|
||||
img = data.moon()
|
||||
img = img_as_ubyte(data.moon())
|
||||
|
||||
# Contrast stretching
|
||||
p2 = np.percentile(img, 2)
|
||||
|
||||
@@ -18,12 +18,12 @@ The example compares the local threshold with the global threshold.
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology.selem import disk
|
||||
import skimage.filter.rank as rank
|
||||
from skimage.filter import threshold_otsu
|
||||
from skimage.morphology import disk
|
||||
from skimage.filter import threshold_otsu, rank
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
p8 = data.page()
|
||||
p8 = img_as_ubyte(data.page())
|
||||
|
||||
radius = 10
|
||||
selem = disk(radius)
|
||||
|
||||
@@ -16,13 +16,14 @@ See Wikipedia_ for more details on the algorithm.
|
||||
|
||||
from scipy import ndimage
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage.morphology import watershed, disk
|
||||
from skimage import data
|
||||
|
||||
# original data
|
||||
from skimage.filter import rank
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
image = data.camera()
|
||||
|
||||
image = img_as_ubyte(data.camera())
|
||||
|
||||
# denoise image
|
||||
denoised = rank.median(image, disk(2))
|
||||
|
||||
Reference in New Issue
Block a user