PyTorch version of `skimage.draw.polygon`? coordinates to mask

Hello everyone.

I’ve been trying quite a bit to figure out a solution here.

I’d like to go from a set of points to a masked image representation of these points. (Filling the pixels within)

skimage.draw.polygon allows me to do just that.

Is there anyone that can assist with a PyTorch implementation?

Many thanks!

1 Like

The internal _polygon method used in skimage seems to iterate the passed coordinates and appends the indices which are inside the polygon, so you could try to adapt this code in PyTorch and reuse it.

Good find! Thank you @ptrblck - Somehow I did not think of looking into the .pyx-file. This is awesome. Will post my version as its complete.

I am also facing the same problem, can I ask if you have solved it ?