Does 2D FillHoles has the concept of scipy's 'structure' ? #173
-
In Does diplib has such control? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
DIPlib’s SciPy’s function applies iterative dilations with the given structuring element. DIPlib’s function uses a queue-based algorithm that propagates a front. This is much more efficient than the repeated dilations. If you want to ignore small gaps in this algorithm, you can apply a dilation before the hole filling, and a corresponding erosion after. |
Beta Was this translation helpful? Give feedback.
-
Understood! Thanks for the swift reply! |
Beta Was this translation helpful? Give feedback.
DIPlib’s
FillHoles()
is controlled by a connectivity parameter. This is equivalent to choosing a 3x3 diamond or a 3x3 square structuring element inbinary_fill_holes
. We don’t allow arbitrary neighborhoods because (1) you don’t necessarily get useful results with them, and (2) it makes the algorithm much more expensive.SciPy’s function applies iterative dilations with the given structuring element. DIPlib’s function uses a queue-based algorithm that propagates a front. This is much more efficient than the repeated dilations.
If you want to ignore small gaps in this algorithm, you can apply a dilation before the hole filling, and a corresponding erosion after.