Hierarchical description and recognition of linear shapes