binarization and line detection