bwmorph examples
Read binary image and display it.
BW = imread('circles.png');
imshow(BW);
Remove interior pixels to leave an outline of the shapes
BW2 = bwmorph(BW,'remove');
imshow(BW2)
Get the image skeleton.
BW3 = bwmorph(BW,'skel',Inf);
imshow(BW3)