Since most memes use the same font, all you do is train Google's Tesseract OCR with this font and use it on these memes.
$ python ocr.py http://cf.chucklesnetwork.com/items/7/7/4/7/6/original/meme-text-impact-font-with-outline.jpg
MEME TEXT
IMPACT FONT WITH
OUTLINE
First instal the dependencies.
$ source setup.sh # This may take a very long time
$ source app.sh
Then move the trained data into the tessdata directory:
$ mv tessdata/eng.traineddata /usr/local/share/tessdata/
You can pass an image or URL to an image as the first argiment to ocr.py
and run it on the command line. The resulting image is saved into result.png
.
$ python ocr.py https://i.imgur.com/YzMXGdQ.jpg
WALKER TOLD US
WE HAVE AIDS
You can also run a Flask server on localhost.
$ python __init__.py
- Setting up a simple OCR server
- Much of the instructions are here
- https://github.com/johnlinp/meme-ocr
- This guy already had the trained data that I just took from him
- Minimal Theme