modified for tesseract 3.02