How do I locate the end points of a bridge-like structure in an image?
Below is a generalized representation.
A generic approach comes to mind:
1) trace the outline and turn it into a path. So there is one path that goes all around the shape, it being made out of line segments
2) look for the stem - the place on the path where the line segments are approximately parallel for some distance (a spatial index e.g. octree or kdtree will help keep the search localised)
3) follow the path in some direction until the two sides suddenly diverge. That's an endpoint to the stem
4) follow the path in the other direction to find the other endpoint