User:Alexander Roidl/WebOCR: Difference between revisions
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
[http://tesseract.projectnaptha.com/ Tesseract.js] | [http://tesseract.projectnaptha.com/ Tesseract.js] | ||
==Tesseract JS== | |||
Insert the library | |||
<pre> | |||
<script src="https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/tesseract.js"></script> | |||
</pre> | |||
main function | |||
<pre> | |||
<script> | |||
function runOCR(url) { | |||
Tesseract.recognize(url) | |||
.then(function(result) { | |||
document.getElementById("ocr_results") | |||
.innerText = result.text; | |||
}).progress(function(result) { | |||
document.getElementById("ocr_status") | |||
.innerText = result["status"] + " (" + | |||
(result["progress"] * 100) + "%)"; | |||
}); | |||
} | |||
document.getElementById("go_button") | |||
.addEventListener("click", function(e) { | |||
var url = document.getElementById("url").value; | |||
runOCR(url); | |||
}); | |||
</script> | |||
</pre> |
Revision as of 11:30, 29 January 2018
Web OCR
Libraries
I tried the OCRAD JS
http://antimatter15.com/ocrad.js/demo.html
and the tesseract JS
Tesseract JS
Insert the library
<script src="https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/tesseract.js"></script>
main function
<script> function runOCR(url) { Tesseract.recognize(url) .then(function(result) { document.getElementById("ocr_results") .innerText = result.text; }).progress(function(result) { document.getElementById("ocr_status") .innerText = result["status"] + " (" + (result["progress"] * 100) + "%)"; }); } document.getElementById("go_button") .addEventListener("click", function(e) { var url = document.getElementById("url").value; runOCR(url); }); </script>