Necesito cargar con un input
una imagen para procesarla con tesseract
, pero una vez que la tengo cargada el botón "Procesar imagen" no lo envía a la función en js
para hacer el reconocimiento, ¿Qué estoy haciendo mal?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> OCR DEMO</title>
</head>
<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>
<script>
function cargar()
{
var myImage= document.getElementById('userImage');
Tesseract.recognize(myImage).then(function(result){
console.log(result.text);
alert(result.text);
});
}
</script>
<body>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="photo" id="userImage" required>
<button class="btn btn-primary btn-round" onclick="cargar()">Procesar imagen</button>
</form>
</body>
</html>