Improve performance of findLines() in ImageClass.