TransWikia.com

How to dilate binary image from outside-to-inside?

Mathematica Asked by TumbiSapichu on March 25, 2021

I have a binary image of a line, like this one:

enter image description here

What I’d like to do is to dilate the line, but only towards the ‘inside’ of the line. That is, to add white pixels towards the center of the image, using DiskMatrix[] or any other kernel of a given radius/size. I’ve been trying to find ways to do this for a bit but I have no idea where/how to begin.

Thanks!

One Answer

Because the Manipulate is fun:

woof = Import["https://i.stack.imgur.com/JKnlk.png"];
mask = WatershedComponents[woof] // Colorize // Binarize

enter image description here

Manipulate[Dilation[Binarize@woof, i]*mask, {i, 1, 100}]

enter image description here

Correct answer by b3m2a1 on March 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP