I want to extract text from some images with messy backgrounds.

First step was switching to gray scale, applying an edge detection algorithm, and then cleaning up a little bit.

Here's an example of the result:

I want to use the tesseract OCR to extract the text from it, but it's not good enough to find it, as the background is quite messed up still. (I tried with a cleaner version and it's doing ok).

So, could anyone recommend an algorithm, or a type of algo, that would help me clean up this image and just get the text? (it will always have this font).

One idea I had was to try to remove all the clumps that are "larger" than the font, which is pretty thin.

ps: hopefully it's the right stackexchange site.


1 Answer 1


Turns out, the trick to solve this was just to realize that from frame to frame the background was changing, but the text was staying constant. So by doing an | operation on the pixel values of a few consecutive frames, it was crazy simple to get only the text.

  • $\begingroup$ It is great you solved it by yourself and shared with us. Welcome! $\endgroup$
    – Royi
    Commented Oct 19, 2019 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.