1 | initial version |
I see two possible ways of doing this.
One, detect circles and when two run into each other, you can cut it there. Getting this to work reliably may be difficult.
Two, more likely to work, is to characterize the contour on the outside edge. It should never have a corner tighter than 90 degrees. From there, draw a straight line to the nearest other <90 degree corner and split it. Unfortunately, I don't have quite enough experience using the contours to know how to do that in code.