Fix warnings generated by gallery examples

This commit is contained in:
Stefan van der Walt
2014-12-15 02:20:12 +02:00
parent df42414782
commit 21d3f151c0
5 changed files with 13 additions and 9 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ import matplotlib.patches as mpatches
from skimage import data
from skimage.filters import threshold_otsu
from skimage.segmentation import clear_border
from skimage.morphology import label, closing, square
from skimage.measure import label
from skimage.morphology import closing, square
from skimage.measure import regionprops
from skimage.color import label2rgb
+1 -1
View File
@@ -1,5 +1,5 @@
"""
=====================================
======================================
Drawing Region Adjacency Graphs (RAGs)
======================================
+1 -2
View File
@@ -11,8 +11,7 @@ import matplotlib.pyplot as plt
import numpy as np
from skimage.draw import ellipse
from skimage.morphology import label
from skimage.measure import regionprops
from skimage.measure import label, regionprops
from skimage.transform import rotate
@@ -37,7 +37,7 @@ ax2.imshow(yellow_multiplier * image)
In many cases, dealing with RGB values may not be ideal. Because of that, there
are many other `color spaces`_ in which you can represent a color image. One
popular color space is called HSV_, which represents hue (~the color),
popular color space is called HSV, which represents hue (~the color),
saturation (~colorfulness), and value (~brightness). For example, a color
(hue) might be green, but its saturation is how intense that green is---where
olive is on the low end and neon on the high end.
@@ -46,6 +46,9 @@ In some implementations, the hue in HSV goes from 0 to 360, since hues wrap
around in a circle. In scikit-image, however, hues are float values from 0 to
1, so that hue, saturation, and value all share the same scale.
.. _color spaces:
http://en.wikipedia.org/wiki/List_of_color_spaces_and_their_uses
Below, we plot a linear gradient in the hue, with the saturation and value
turned all the way up:
"""
@@ -69,6 +72,8 @@ Notice how the colors at the far left and far right are the same. That reflects
the fact that the hues wrap around like the color wheel (see HSV_ for more
info).
.. _HSV: http://en.wikipedia.org/wiki/HSL_and_HSV
Now, let's create a little utility function to take an RGB image and:
1. Transform the RGB image to HSV
@@ -147,7 +152,4 @@ plt.show()
For coloring multiple regions, you may also be interested in
`skimage.color.label2rgb <http://scikit-image.org/docs/0.9.x/api/skimage.color.html#label2rgb>`_.
.. _color spaces:
http://en.wikipedia.org/wiki/List_of_color_spaces_and_their_uses
.. _HSV: http://en.wikipedia.org/wiki/HSL_and_HSV
"""
+3 -1
View File
@@ -60,10 +60,12 @@ def windowed_histogram_similarity(image, selem, reference_hist, n_bins):
# a measure of distance between histograms
X = px_histograms
Y = reference_hist
num = (X - Y) ** 2
denom = X + Y
denom[denom == 0] = np.infty
frac = num / denom
frac[denom == 0] = 0
chi_sqr = 0.5 * np.sum(frac, axis=2)
# Generate a similarity measure. It needs to be low when distance is high