Lurker News

Comments (97) 35 threads

xigency3 replies#
To anyone screen capturing small fonts as a demonstration, or capturing digital text especially at a small resolution, I don't believe that that is the purpose of this OCR library. (As a specialized problem, that might be easier to solve depending on the typeface.)

A much better example that works quite well is a picture of someone holding a book: http://i.imgur.com/3JWs64x.jpg

    Magic .
    Read this to yourself. Read it silently
    Don't move your lips. Don’t make a suund
    Listen to yourself. Listen without hearing
    What a wonderfully weird thing, huh?
    NOW MAKE THIS PART LOUD!
    SCREAM IT IN YOUR MIND!
    DROWN EVERYTHING OUT.
    Now, hear a whisper. A tiny whisper.
    New, read this next line with your best crotchety—
    old-man voice:

    “Hello there, sonny. Does your town have apost 0
    Awesome! Who was that? Whose voice was that?
    It sure wasn’t yours!

    How do you do that?
    How?!
    Must be magic.
Problems with this text: misspelled 'sound' as 'suund', didn't recognize the word 'anything', and mis-recognized 'a post office' as 'apost 0'.

Not bad. Especially since two of three mistakes are on the edge of the page.

minism2 replies#
The old man voice was spoken in my mind as Deckard Cain.
holografix#
I stayed a while and I listened
jbhatab#
it was instantaneous Deckard Cain for me.
Ph0X1 reply#
Isn't this an issue with the algorithm?

Can someone try and see how it would perform if you simply upscale the image using normal bicubic interpolation? And if it performs much better, I feel like that should be a preprocessing option to scale up the image since it seems to do so poorly on small resolutions.

kixpanganiban1 reply#
Tesseract's Github Readme actually recommends upscaling for better results:

https://github.com/naptha/tesseract.js#tesseractrecognizeima...
> Note: image should be be sufficiently high resolution. Often, the same image will get much better results if you upscale it before calling recognize.

derefr1 reply#
Presumably, the result would be even better if you put a filter that did a path-tracing/auto-vectorization step first, upscaled by an arbitrary amount, and then rasterized the result. Analogue sources would have their traced paths distorted by such a process in a way that's lossier than just using the noisy analogue source—but for actually-digital-from-the-beginning images, it'd work perfectly.

Continue this thread — 1 reply

SeriousM#
Thanks, the text is awesome!
pyronite5 replies#
The text detection is lacking in comparison to Google's Vision API. Here is a real-life comparison between Tesseract and Google's Vision API, based on a PDF a user of our website uploaded.

Original text [http://i.imgur.com/CZGhKhn.png]:
> I am also a top professional on Thumbtack which is a site for people looking for professional services like on gig salad. Please see my reviews from my clients there as well
Google detects [http://i.imgur.com/pSJym1x.png]:
> “ I am also a top professional on Thumbtack which is a site for people looking for professional services like on gig salad. Please see my reviews from my clients there as well ”
Tesseract detects [http://i.imgur.com/wwbLU6g.png]:
> \ am also a mp pmfesslonzl on Thummack wmcn Is a sue 1m peop‘e \ookmg (or professmna‘ semces We on glg salad P‘ezse see my rewews 1mm my cuems were as weH

bijection2 replies#
Although Google's API is certainly better, Tesseract.js should work similarly if you increase the font size. Screenshots taken on 'retina' devices are around the smallest text it can handle well.

Edit:
A screenshot of the same text at a higher resolution: https://imgur.com/a/W7IGu
Tesseract.js output: https://imgur.com/a/niIfM
"I am also a top professional on thumbtack which is a site for people looking for professional services like on gig salad. Please see my reviews from my clients there as well"

jaytaylor2 replies#
Your comment (zoomed in Chrome on Win 10): http://i.imgur.com/uuFhw90.png

Tesseract.js analysis:

    Although Googie's API is certaihiy better,
    Tesseract.js should work simiiarly if you
    increase the font size.
    Screenshots taken
    on 'retiha’ devices are around the smailest
    text it can handie well.

    Edit:

    A screenshot of the same text at a higher
    resolution:
    httgs:[[imgurxomZaN/UGu

    Tesseract.js
    output: httgs://imguricom[a[hiIfM
This is a neat toy, but not impressive compared to the results from tesseract-ocr/tesseract [0]:

    $  curl -s http://i.imgur.com/uuFhw90.png \
        | tesseract stdin stdout

    Although Google's API is certainly better,
    Tesseract.js should work similarly if you
    increase the font size.
    Screenshots taken on 'retina' devices are
    around the smallest text it can handle well.

    Edit:
    A screenshot of the same text at a higher
    resolution: https:[ZimguncomlalWHGu
    Tesseract.js output:
    https:[[imgur.com[a[nilfM
Notice how Tesseract.js results suffer from being unable to differentiate between n's and h's, i's and l's.

[0] https://github.com/tesseract-ocr/tesseract

bijection2 replies#
That's interesting! Given that Tesseract.js wraps an Emscripten'd copy of Tesseract, I would have expected close to identical performance. This might have to do with the way we threshold images, with the age of the tesseract version we're using, or both. I'll look into it!

Edit: In addition to those differences, I think your font size is still a bit too small. On an unedited screenshot from a macbook (https://i.imgur.com/iv4ZdSt.png) I get

  Although Google's API is certainly better, Tesseract.js should work similarly if you increase the font size. Screenshots taken on 'retina' devices are around the smallest text it can handle well.

  Edit:

  A screenshot of the same text at a higher resolution: https:[[imgur.com[a[W7IGu

  Tesseract.js output: https:[[imgur.com[a[niIfM

  “I am also a top professional on thumbtack which is a site for people looking for professional services like on gig salad. Please see my reviews from my clients there as well"

Continue this thread — 2 replies

brazzledazzle#
Hey just a reminder that this is a ShowHN which has its own rules. Honesty is okay but aim to be respectful.
oriolid#
I've used Tesseract for a production OCR project some years ago, and can confirm too that it just doesn't work at screen resolution. On the other hand, performance on high DPI photos was quite OK. Google Vision API wasn't around at that time so I can't compare.
ajacksified3 replies#
I spent many afternoons trying to get tesseract to read Dwarf Fortress screenshots, such as http://i.imgur.com/32vVhnH.png - including much pre-processing, such as converting the text to black and white. Alas, I never even got close.

Edit: just tried Google's, and it had one mistake for that entire file. That's pretty impressive.

bijection1 reply#
Upscaling worked ok for me:

Upscaled image: https://imgur.com/a/4IQA7
Result on demo page: http://imgur.com/a/A0v5C
The hammerman Tikes flsosushsath: Greetings. My name is Tikes Leafsilk.
You: Rh. hello. I'm Stasbo Murderknower the Craterous Trance of Fins. Don't travel alone at night. or the bogeyman will get you.
You: Tell me about this hall.
Tikes: This is The flccidental Ualley. In 123, Stasho Steamdances ruled from The flccidental Ualley of The Council of Cobras in Ueilapes.
...

xigency#
This seems like a font issue. Would training the model for this console font help?
jackhack1 reply#
Since we're trading "I failed" stories...

I spent a weekend tying Tesseract together with Tekkotsu (the amazing open framework for the Sony AIBO) in an attempt to teach my robot dog to read. The eventual goal being to hook up the output of OCR --> Text To Speech (TTS) and have him read to me.
Alas, the low resolution of the camera was an insurmountable problem. Poor Aibo needed 40-point fonts and I practically had to rub his nose in the book. Not exactly the user experience I was aiming for.
Never got around to the TTS part.

Accacin2 replies#
I completely missed the word "robot" then and was pretty impressed that you wanted to teach your dog to read.

Continue this thread — 2 replies

zo1#
If you're reading screenshots of a non-changing font, you could quite easily get away with plain template-matching. Simply do a run through and label the data one time.

I did something like that a few years ago when making an Eve-Online UI scraper.

driverdan1 reply#
We spent a decent amount of time evaluating Abbyy vs Tesseract vs Cloud Vision. Cloud Vision wins hands down and is very reasonably priced.
emmelaich#
There is a Chrome Extension for Cloud Vision which works well and seems to be free.

Written by a Google employee, see top link at http://www.imjasonh.com/projects

doctorcroc1 reply#
Google Cloud Vision API is very expensive though -- if you can sacrifice some amount of quality, it might make sense to go with the open source alternative. At $2.50/unit the cost is absurd, and even the free trial expires after 90 days.
Huppie3 replies#
I just checked because I couldn't believe that price.

"Price per 1000 units. Unit volumes are based on monthly usage." It's $2.50 per 1000 units, so 0.25 cents per unit.
Edit: And, according to the pricing page [1] the first 1000 units are free.
[1]: https://cloud.google.com/vision/pricing

noteone#
This is the correct pricing. One caveat: Even the free tier requires you to enter a credit card.

For higher volumes, there is also the OCR.space api. It offers 25,000 free conversions per month. It is not as good as Google, but works fine on screenshots.

doctorcroc#
My mistake -- thanks for pointing that out. I think I was in shock, and didn't take a closer look.
ben174#
Note that's $0.0025 per unit, not 25 cents per unit. Your post is correct, but, ya know, Verizon math is a real thing.
Omnipresent#
How do you test sample images with google's vision api? Do you have to sign up for a 90 day trial or do they allow you to upload images for trial.
iplaw5 replies#
HOW is there not a better, almost 100% accurate OCR tool?

I routinely (daily) need to OCR PDF files. The PDF files are not scans. They are PDF files created from a Word file. The text is 100% clear, the lines are 100% straight, and the type is 100% uniform.
And, yet, Microsoft and Google OCR spits out gibberish that is full of critical errors.
From a problem solving perspective, this seems like an incredibly easy problem to solve in this exact use case. That is, PDFs generated from text files. Identify a uniform font size (prevent o-to-O and o-to-0 errors), identify a font-family (serif, sans-serif, narrow to particular fonts), and OCR the damn thing. And yet, the output is useless in my field.

nabla91 reply#
Why do you use OCR and not PDF to text conversion?
angry-hacker2 replies#
Probably because the pdf is just a big image file? If I understand correctly. Otherwise it should be just copy paste from pdf.
pitaj1 reply#
> The PDF files are not scans. They are PDF files created from a Word file.

I am unsure as to why he can't just copy / paste.

Continue this thread — 1 reply

iplaw#
Right. It's an image PDF generated from a text file, so there are no digital-to-analog-to-digital errors introduced. These files should be perfect OCR candidates, but everything that I've found is full of errors, missing portions of sentences, rearranged fragments, etc.
ousta1 reply#
it dosnt make sense to use ocr for this. libraries such as aspose will do much better
iplaw1 reply#
Apologies for not being clear in my OP. The PDF is a digital-native image produced from a text document, but without embedded or searchable text. Looking at the PDF in full resolution, there are not artifacts, blurry characters, or any alignment or uneven scale issues that are troublesome when attempt to OCR a scan or photograph. It looks exactly like a Word document, but without selectable or editable text.

So, I do have to use OCR, right?

niutech#
Maybe not. The PDF probably has an embedded text (so it doesn't blur when zomming in) but it could be either cinverted into vector curves or protected from copying (see properties). The easiest way is to change the PDF export settings in Word/Ghostscript/Distiller.
hrehhf1 reply#
Debian has a command-line tool 'pdftotext' which extracts the text from a PDF. It is not OCR, it pulls the characters from the file itself. Its in the package called poppler-utils.
iplaw1 reply#
Apologies for not being clear in my OP. The PDF is a digital-native image produced from a text document, but without embedded or searchable text. Looking at the PDF in full resolution, there are not artifacts, blurry characters, or any alignment or uneven scale issues that are troublesome when attempt to OCR a scan or photograph. It looks exactly like a Word document, but without selectable or editable text.
dreamcompiler#
There are a couple of ways a PDF document could contain actual text that is nevertheless not selectable or searchable. One is that the originator could have protected the document; another (more common) cause is that the originator didn't embed the proper font maps when exporting the document. I see the latter a lot with documents produced from LaTeX originals. As the parent mentioned, pdftotext can often extract text from such documents without the need for OCR. (Although sometimes if the document contains ligatures those don't get converted.)

Continue this thread — 2 more replies

jameslk1 reply#
For all those claiming issues with reading text from a screen shot of this page, note that this is more an issue with the original Tesseract library, not this library (which appears to wrap Tesseract compiled through Emscripten). I remember having a similar issue when I used the original Tesseract. The quick hack I found to fix it was to rescale any small text input images 3x first before feeding it to Tesseract. I'm sure there's more intelligent solutions to mitigate that problem.

Continue this thread — 1 reply

Load more comments