How can I use the skimage before the OCR

Currently, I m playing around with the image preprocessing to increase the quality of the OCR process using Google Tesseract. I m trying to find the set of magic filters that gives me a better input for the Tesseract. So I want to keep edges and details, but remove noises etc. Do You know How the scikit-image can help me >

Hi @Marek_Kapowicki, welcome to and thanks for the question.

scikit-image has a couple of filters. See the full list at Module: filters — skimage v0.18.0 docs. Some were originally designed for text recognition, for example Sauvola, and this information is mentioned in the previous link. Also, previous link has some minimal examples of how to apply the filters.

Write us back with more specific questions!

Thanks for the invitation - the library looks really impressive and for me, it is a light alternative to OpenCV

Coming back to my question I m trying to apply the chain of filter to the input image with text and improve the readability of letters so

  1. Enlarge the small images → easy
  2. Increase the contrast if needed (the current contrast is low) → easy
  3. Deskew the rotated image
  4. Remove some noises from the background, but keeping the shape of letters and edges. Here so far the bilateral works quite nice - but maybe it is something better to achieve my goal
  5. Sharp the edges of letters → here I m trying the unsharp mask, but I m not happy with the results. Many details (especially for passports, ids, driving licenses) are left in a background
  6. Binarization - to achieve the black letters & white background. Here the global Yen or local adaptive works best so far
  7. Fill the empty gaps (pixels) in a letter → here I m trying morphology (opening, closing)
  8. etc
    I have spent so far a few days experimenting with the filters, but still, I am far away from the ideal solution. I can see that there are plenty of useful filters and maybe someone can help me a bit with the investigation