[Python] How to smooth out a 3d boolean mask

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    I have a 3D mask that is "highly textured" and I want to smooth it out, preferably using python scipy.ndimage functions. This is an example cross section. [​IMG]

    I see scipy.ndimage.binary_erosion and a lot of other binary functions: dilation, fill_holes, opening, closing, and hit_or_miss. Which of these will work best to smooth out my mask?

    I would like the result to be like this...

    [​IMG]

    I tried to call label and eliminate all the small islands, and then call binary_fill_holes, but the result was still very coarse. I was thinking about repeatedly calling erosion and dilation as a way of smoothing, but I think that will tend to remove the "corners" of the shapes.

    Continue reading...

Compartilhe esta Página