Improve performance of findLines() in ImageClass.

Now it roughly five time faster.