Skip to content

Commit

Permalink
Simplify alpha vector generation
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Jan 27, 2016
1 parent c8ba77d commit 772dc48
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions skimage/draw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 772dc48

Please sign in to comment.