Create polygon outline for sprite

I tested to create an outline for a sprite and the make a simplified polygon (Using Douglas-Peucker) to use with box2d. I think I’ve seen something similar here before.

Here is the code if someone is interested.
https://gist.github.com/tnlogy/3700c8dc44409222153ad17309b628e2

Touch the screen to randomize a new object. I’m interested in using the watershed algorithm to be able to use photos and find an object in them. Lets see how that goes…

Here’s a link to some code I wrote to create an outline. This is from 2019. I’m not sure where the original post is at in the forum.

https://www.codea.io/talk/discussion/9789/creating-a-outline-on-your-image

Nice! The difference is that my code creates a vector outline. I found the old thread I was thinking about!

https://codea.io/talk/discussion/2297/utility:-create-a-physics-object-that-follows-the-exact-outline-of-your-image