Curve Skeletonization by Junction Detection