Comments:"Ocrad.js - Optical Character Recognition in Javascript"
URL:http://antimatter15.com/wp/2013/12/ocrad-js-pure-javascript-ocr-via-emscripten/
Ocrad.js
Optical Character Recognition in JS
This was made by antimatter15 (please follow me on Twitter or G+)
Below is a simple demo, which should hopefully demonstrate the capabilities but will more likely show the substantial limitations of the library. Hit the buttons on the left to reset the canvas or to randomly put some text in a random font. You can also try to draw something with your cursor.
You can also drag and drop an image from your computer (JPEG, PNG, GIF, BMP, SVG, or NetPBM) to feed into the text recognizer or choose a file by clicking anywhere on this box.
<script src="ocrad.js"></script>
This file exposes a single global function, OCRAD which takes an image as an argument and returns the recognized text as a string.
var string = OCRAD(image);
alert(string);
string OCRAD.version()
void OCRAD.write_file(string filename, Uint8Array PBM Image Data)
pointer OCRAD.open()
int OCRAD.close(pointer descriptor)
(and more!)
Unlike GOCR.js, Ocrad.js is designed as a port of the library, rather than a wrapper around the executable. This means that processing subsequent images doesn't involve reinitializing an executable, so processing an image can be done in as little as an eighth of the time it takes GOCR.js to do the same (The fact that Ocrad is naturally faster than GOCR doesn't hurt this statistic either).
With a simple script which generates some text in some random font selected from the Google Font API, I ran a few hundred trials comparing the recognized text with the original text. The metric was a modified Levenshtein distance where the substitution cost for capitalization errors is 0.1. Of 485 trials, 175 trials ended up favoring GOCR.js, 184 favoring Ocrad.js, and 126 resulted in a tie. From playing with the draw tool, it seems that Ocrad is much more predictable and forgiving for minor alignment and orientation errors.
There have been some other comparisons on the performance of OCRAD versus GOCR. In this comparison done by Peter Selinger, Ocrad comes out just behind Tesseract. Another comparison by Andreas Gohr has GOCR performing better than Ocrad.
Accuracy wise, they're actually pretty close. It might be possible to create something which meshes together the outputs of both, picking whichever output matches a certain heuristic for quality. Ocrad does seem to vastly outperform GOCR when it comes to letter sketches on a canvas, so that's the one I'm focusing on here.