Preprocessing images before OCR