A quasi-topological method for the recognition of line patterns