From 772dc48337874a6b426e544d04785669de0120a1 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 27 Jan 2016 14:28:40 -0800 Subject: [PATCH] Simplify alpha vector generation --- skimage/draw/draw.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/skimage/draw/draw.py b/skimage/draw/draw.py index 325137ed..862e4c3c 100644 --- a/skimage/draw/draw.py +++ b/skimage/draw/draw.py @@ -179,10 +179,9 @@ def set_color(img, coords, color, alpha=1): img.shape[-1])) if np.isscalar(alpha): - rr, cc = _coords_inside_image(rr, cc, img.shape) - alpha = np.ones_like(rr) * alpha - else: - rr, cc, alpha = _coords_inside_image(rr, cc, img.shape, val=alpha) + alpha = np.full_like(rr, alpha, dtype=float) + + rr, cc, alpha = _coords_inside_image(rr, cc, img.shape, val=alpha) alpha = alpha[..., np.newaxis]