There is no concept of inner or outer for shape like this.
The idea is first find the skeleton of the shape, for each point on skeleton, draw vertical line according to the slope, calculate the intersection points between the line and shape boundary.
Smoothing the shape or there will be many noises.