Matlab\'s bwmorph(X, \'endpoints\') provides the endpoints of a skeleton for the given binary image X.
bwmorph(X, \'endpoints\')
X
For example-
1 0 0