NMAC427 / SwiftOCR

Fast and simple OCR library written in Swift
Apache License 2.0
4.6k stars 481 forks source link

Preprocessing on small images #37

Open pabloromeu opened 7 years ago

pabloromeu commented 7 years ago

Hi again,

I have been playing around with some small images of text to check whether I could recognize some text on them, although I retrained the NN, tweaked some parameters... But no luck. I think it might be the preprocessing algorithm that lead to a non-readable text.

My original image: sample5

What SwiftOCR debug says: captura de pantalla 2016-07-23 a las 16 27 16

Maybe it is the size of the image?

NMAC427 commented 7 years ago

First of all this image is way to small. Try to get a higher resolution image. Another problem is, that the characters are touching the edge of the image. If they are touching the edge they automatically get filtered out, so don't crop the image that much.

pabloromeu commented 7 years ago

Which is the minimum? What about resizing the image?

NMAC427 commented 7 years ago

I would say each character should be at least 20 x 20 px large. You can try to resize the image as long as the characters aren't touching each other. Good luck.

NMAC427 commented 7 years ago

I've scaled up the image to about twice its original size and added a 5px border. It got all bounding boxes correct except for the i.

48baa5c2-50f2-11e6-8c35-a03893aaf6b2 bildschirmfoto 2016-07-23 um 20 56 53