mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
API Change: image_label2rgb changed to label2rgb.
The name change reflects a switch in the argument order (and makes the image an optional argument).
This commit is contained in:
@@ -160,11 +160,11 @@ individually.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.color import image_label2rgb
|
||||
from skimage.color import label2rgb
|
||||
|
||||
segmentation = ndimage.binary_fill_holes(segmentation - 1)
|
||||
labeled_coins, _ = ndimage.label(segmentation)
|
||||
image_label_overlay = image_label2rgb(coins, labeled_coins)
|
||||
image_label_overlay = label2rgb(labeled_coins, image=coins)
|
||||
|
||||
plt.figure(figsize=(6, 3))
|
||||
plt.subplot(121)
|
||||
|
||||
@@ -17,7 +17,7 @@ import matplotlib.pyplot as plt
|
||||
from skimage.filter import sobel
|
||||
from skimage.segmentation import slic, join_segmentations
|
||||
from skimage.morphology import watershed
|
||||
from skimage.color import image_label2rgb
|
||||
from skimage.color import label2rgb
|
||||
from skimage import data
|
||||
|
||||
|
||||
@@ -48,15 +48,15 @@ fig, axes = plt.subplots(ncols=4, figsize=(9, 2.5))
|
||||
axes[0].imshow(coins, cmap=plt.cm.gray, interpolation='nearest')
|
||||
axes[0].set_title('Image')
|
||||
|
||||
color1 = image_label2rgb(coins, seg1, bg_label=0)
|
||||
color1 = label2rgb(seg1, image=coins, bg_label=0)
|
||||
axes[1].imshow(color1, interpolation='nearest')
|
||||
axes[1].set_title('Sobel+Watershed')
|
||||
|
||||
color2 = image_label2rgb(coins, seg2, image_alpha=0.5)
|
||||
color2 = label2rgb(seg2, image=coins, image_alpha=0.5)
|
||||
axes[2].imshow(color2, interpolation='nearest')
|
||||
axes[2].set_title('SLIC superpixels')
|
||||
|
||||
color3 = image_label2rgb(coins, segj, image_alpha=0.5)
|
||||
color3 = label2rgb(segj, image=coins, image_alpha=0.5)
|
||||
axes[3].imshow(color3, interpolation='nearest')
|
||||
axes[3].set_title('Join')
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from skimage.filter import threshold_otsu
|
||||
from skimage.segmentation import clear_border
|
||||
from skimage.morphology import label, closing, square
|
||||
from skimage.measure import regionprops
|
||||
from skimage.color import image_label2rgb
|
||||
from skimage.color import label2rgb
|
||||
|
||||
|
||||
image = data.coins()[50:-50, 50:-50]
|
||||
@@ -38,7 +38,7 @@ clear_border(cleared)
|
||||
label_image = label(cleared)
|
||||
borders = np.logical_xor(bw, cleared)
|
||||
label_image[borders] = -1
|
||||
image_label_overlay = image_label2rgb(image, label_image)
|
||||
image_label_overlay = label2rgb(label_image, image=image)
|
||||
|
||||
fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))
|
||||
ax.imshow(image_label_overlay)
|
||||
|
||||
Reference in New Issue
Block a user