Grouping lines. Finding curvilinear structures in images