Algorithm for forming relationships between objects in a scene

An algorithm is described for forming the chaincode and the tree of relationships of the islands and lakes within a bilevel image.