You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several changes I would suggest we make to the morphological operators for 2.0 that will change their results. The goal is to make the gray-scale and binary versions of the operators consistent. For any binary image and SE (footprint), I'd expect dilation to produce the exact same result as binary_dilation. This requires changing some defaults:
The boundary extension parameter mode should default to ignore for all morphological filters. This produces the least amount of surprise in users, and ensures that the morphological operators satisfy their expected properties even close to the image edge. For example, the closing is extensive, so we expect closing(img, footprint=footprint) >= img. This is not always the case with the current default boundary extension 'reflect'. The binary operators already use 'ignore'.
Padding of even-sized SEs: currently the binary dilation and erosion pad on the left, and the gray-value ones on the right. One should be changed to match the other.
Mirroring of SE in dilation: currently binary_dilation mirrors the SE (it's mirrored by the ndimage implementation we're calling), but dilation doesn't. Using an asymmetric footprint we can see this:
Either option is fine, there are two different definitions as I described in Morphological closing and opening are incorrect #6676. But we must remember to adjust the opening and closing operators so that they remain correct.
This issue is a follow-up to the changes in #6695.
Description:
There are several changes I would suggest we make to the morphological operators for 2.0 that will change their results. The goal is to make the gray-scale and binary versions of the operators consistent. For any binary image and SE (footprint), I'd expect
dilationto produce the exact same result asbinary_dilation. This requires changing some defaults:The boundary extension parameter
modeshould default toignorefor all morphological filters. This produces the least amount of surprise in users, and ensures that the morphological operators satisfy their expected properties even close to the image edge. For example, the closing is extensive, so we expectclosing(img, footprint=footprint) >= img. This is not always the case with the current default boundary extension 'reflect'. The binary operators already use 'ignore'.Padding of even-sized SEs: currently the binary dilation and erosion pad on the left, and the gray-value ones on the right. One should be changed to match the other.
Mirroring of SE in dilation: currently
binary_dilationmirrors the SE (it's mirrored by the ndimage implementation we're calling), butdilationdoesn't. Using an asymmetric footprint we can see this:Either option is fine, there are two different definitions as I described in Morphological closing and opening are incorrect #6676. But we must remember to adjust the opening and closing operators so that they remain correct.
This issue is a follow-up to the changes in #6695.