Modify the border/stroke of an image

Hi everybody, I need to modify the border of an image, like reducing the stroke from this image. Would you mind helping me with that? A sample has been uploaded.


Ps: I used torchvision.transforms.Pad class , but that wasn’t what I wanted.

Hey, I believe what you want/needs here is the morphological operation erosion (Mathematical morphology - Wikipedia)

You can achieve that with pytorch using kornia – Kornia docs erosion morph (kornia.morphology - Kornia)

Kornia tutorials morph (Kornia - Introduction to Morphological Operators)

1 Like

Thank you for your comprehensive reply, I’ll take a look at all of them!