A VARIATIONAL ALGORITHM FOR THE DETECTION OF LINE SEGMENTS