Hello,
I noticed that the opening operator isn’t idempotent with asymmetrical structuring elements.
For example, try the following code
import skimage
from skimage.data import camera
from skimage.morphology import opening, disk
import numpy as np
from matplotlib import pyplot as plt
print('Skimage version:', skimage.__version__)
im = camera()
# symmetric SE
se = disk(1) # 4-connexity cross
imOp = opening(im,se)
imOp2 = opening(imOp,se)
print('Difference after opening twice (sym. SE):', np.abs(imOp-imOp2).max())
# non-symmetric SE
se = np.zeros((3,3))
se[0, 2] = 1
se[1, 1] = 1
se[2, 2] = 1
imOp = opening(im,se)
imOp2 = opening(imOp,se)
print('Difference after opening twice (non-sym. SE):', np.abs(imOp-imOp2).max())
plt.figure()
plt.imshow(im, cmap = 'gray')
plt.figure()
plt.imshow(np.abs(imOp2-imOp), cmap = 'gray')
plt.show()
Best regards,
José-Marcio
1 Like
Sorry,
A colleague of mine already posted this problem at github scikit-image forum, with more informative information.
Please feel free to close one of this messages.