-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
From StackOverflow/45682644:
The following script computing peak_local_max
on a binary image takes a very long time to complete.
from scipy import ndimage as ndi
from skimage import feature, io, img_as_float, measure, color
import numpy as np
binary_image_of_interest = img_as_float(color.rgb2gray(io.imread('test.png'))) > 0.5
cells = binary_image_of_interest
distance = ndi.distance_transform_edt(cells)
local_maxi = feature.peak_local_max(
distance,
footprint=np.ones((3, 3), dtype=np.bool),
indices=False,
labels = measure.label(cells)
)