Skip to content

Commit

Permalink
Merge add4b51 into 73bf701
Browse files Browse the repository at this point in the history
  • Loading branch information
jmetz committed Jan 31, 2014
2 parents 73bf701 + add4b51 commit c61acdf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions skimage/morphology/convex_hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def convex_hull_image(image):
raise ImportError('Could not import scipy.spatial, only available in '
'scipy >= 0.9.')

# Subtract offset
offset = coords.mean(axis=0)
coords -= offset

# Find the convex hull
chull = Delaunay(coords).convex_hull
v = coords[np.unique(chull)]
Expand All @@ -63,6 +67,9 @@ def convex_hull_image(image):
angles = np.arctan2(v_centred[:, 0], v_centred[:, 1])
v = v[np.argsort(angles)]

# Add back offset
v += offset

# For each pixel coordinate, check whether that pixel
# lies inside the convex hull
mask = grid_points_inside_poly(image.shape[:2], v)
Expand Down

0 comments on commit c61acdf

Please sign in to comment.