OCR works best for black on white or binary images, where letters have sharp contours, no noise, and solid filling, i.e. they are nothing like this:

part of a document number

For the curious it's a part of a document number that is embossed. Applying unsharp mask, thresholding, closing and median operations already improves it a bit, but it still cannot be processed properly by OCR.

enter image description here

What other operations could bring the image to the preferable state like this manually edited one:

enter image description here

  • $\begingroup$ aren't you answering your own question? What did you do to achieve that third image? $\endgroup$ – Marcus Müller May 25 '18 at 11:31
  • $\begingroup$ Like I said I manually edited the image with GIMP $\endgroup$ – Rajish May 25 '18 at 11:32
  • $\begingroup$ but what did you do in GIMP? $\endgroup$ – Marcus Müller May 25 '18 at 11:33
  • $\begingroup$ bucket fill and erase tool on the image in the middle. The operations to get the middle image are mentioned in the question. $\endgroup$ – Rajish May 25 '18 at 11:34
  • 2
    $\begingroup$ soooooo what about implementing "bucket fill" to.. fill the outer areas with black, then bucket fill on all areas "touching" the black with green? Then, just select "green"? It's what you've done before, but automatedly. You already work like an algorithm! You just need to learn to write that algorithm down. $\endgroup$ – Marcus Müller May 25 '18 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.