From 7048a9c995e9704340110f1c69d22139da7f9c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 7 Jul 2013 12:05:30 +0200 Subject: [PATCH 1/2] add original picture --- doc/examples/plot_convex_hull.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/examples/plot_convex_hull.py b/doc/examples/plot_convex_hull.py index c5505295..02d08732 100644 --- a/doc/examples/plot_convex_hull.py +++ b/doc/examples/plot_convex_hull.py @@ -27,9 +27,17 @@ image = np.array( [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=float) +original_image = np.copy(image) + chull = convex_hull_image(image) image[chull] += 1.7 image -= -1.7 +fig = plt.subplots(figsize=(10, 6)) +plt.subplot(1, 2, 1) +plt.title('Original picture') +plt.imshow(original_image, cmap=plt.cm.gray, interpolation='nearest') +plt.subplot(1, 2, 2) +plt.title('Transformed picture') plt.imshow(image, cmap=plt.cm.gray, interpolation='nearest') plt.show() From acdfd8bc71bc87027f4354c050848ca78590f041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 7 Jul 2013 12:21:34 +0200 Subject: [PATCH 2/2] simplify modification image + comment --- doc/examples/plot_convex_hull.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/examples/plot_convex_hull.py b/doc/examples/plot_convex_hull.py index 02d08732..31398e6d 100644 --- a/doc/examples/plot_convex_hull.py +++ b/doc/examples/plot_convex_hull.py @@ -30,8 +30,15 @@ image = np.array( original_image = np.copy(image) chull = convex_hull_image(image) -image[chull] += 1.7 -image -= -1.7 +image[chull] += 1 +# image is now: +#[[ 0. 0. 0. 0. 0. 0. 0. 0. 0.] +# [ 0. 0. 0. 0. 2. 0. 0. 0. 0.] +# [ 0. 0. 0. 2. 1. 2. 0. 0. 0.] +# [ 0. 0. 2. 1. 1. 1. 2. 0. 0.] +# [ 0. 2. 1. 1. 1. 1. 1. 2. 0.] +# [ 0. 0. 0. 0. 0. 0. 0. 0. 0.]] + fig = plt.subplots(figsize=(10, 6)) plt.subplot(1, 2, 1)