Line extraction from an image (using Markovian model and energy minimization)