camera, snapshots, ocr v.1
This commit is contained in:
27
express-server/public/ocrscan/ocrscan.js
Normal file
27
express-server/public/ocrscan/ocrscan.js
Normal file
@ -0,0 +1,27 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
//initialize all modals
|
||||
$('.modal').modal();
|
||||
|
||||
$(".btnanalyze").click(function() {
|
||||
analyze();
|
||||
});
|
||||
});
|
||||
|
||||
function analyze() {
|
||||
var img = document.getElementById("canvas").toDataURL();
|
||||
|
||||
Tesseract.recognize(img).progress((progress) => {
|
||||
console.log(progress, "$$$$");
|
||||
|
||||
if (progress.status == "recognizing text") {
|
||||
$(".determinate").css("width", progress.progress * 100 + "%");
|
||||
}
|
||||
}).then((result) => {
|
||||
console.log(result);
|
||||
$(".output").text(result.text);
|
||||
$('.modal').modal("open");
|
||||
|
||||
$(".determinate").css("width", "0%");
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user