Description:
I tried with both of these images:
0_and_255.png
0_and_1.png
Docs saying it should be faster: https://scikit-image.org/docs/stable/api/skimage.morphology.html#skimage.morphology.binary_closing
Way to reproduce:
import time
import numpy as np
from skimage import io, morphology
img = io.imread("tmp/x.png")[:, :, 0]
print(np.unique(img), img.shape, img.dtype) # [0 1] (3508, 2480) uint8
kernel = np.ones((35, 35))
t = time.perf_counter()
morphology.binary_closing(img, kernel)
t2 = time.perf_counter()
morphology.closing(img, kernel)
t3 = time.perf_counter()
print(t2 - t) # 5.420551682997029
print(t3 - t2) # 0.08474353399651591
Version information:
3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] # conda environment
Linux-6.5.0-41-generic-x86_64-with-glibc2.35
scikit-image version: 0.23.2
numpy version: 1.26.4
Description:
I tried with both of these images:
0_and_255.png
0_and_1.png
Docs saying it should be faster: https://scikit-image.org/docs/stable/api/skimage.morphology.html#skimage.morphology.binary_closing
Way to reproduce:
Version information:
3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] # conda environment Linux-6.5.0-41-generic-x86_64-with-glibc2.35 scikit-image version: 0.23.2 numpy version: 1.26.4