I can’t do it with my current level of knowledge, so I would like to ask if processing can achieve this, or is there any other way to do it, machine learning may be a bit difficult for me LOL.
This can be achieved through a convex hull operation (for shape that have holes or multiple islands; for shapes like the heart, computing its convex hull will not return exactly return the shape you’re looking for).
This functionality is provided by a few Processing libraries including my own, Processing Geometry Suite.