Optimization of the Extended Water Flow Algorithm for the Text-Line Segmentation