Pure Javascript OCR for more than 100 Languages 📖🎉🖥
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<canvas id="c"></canvas>
|
|
|
|
<script type="text/javascript" src="./build/tesseract.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var canvas = document.getElementById('c')
|
|
|
|
canvas.width = 400
|
|
|
|
canvas.height = 400
|
|
|
|
var ctx = canvas.getContext('2d');
|
|
|
|
ctx.font = '30px "Arial Black"'
|
|
|
|
ctx.fillText('Hell0 World', 100, 40)
|
|
|
|
// ctx.fillText("囚犯離奇掙脫囚犯離奇掙脫", 100, 40)
|
|
|
|
ctx.font = '30px "Times New Roman"'
|
|
|
|
ctx.fillText('from beyond', 100, 80)
|
|
|
|
// ctx.fillText('2小時可換乘2次2小時可換乘2次', 100, 80)
|
|
|
|
ctx.font = '30px sans-serif'
|
|
|
|
ctx.fillText('the Cosmic Void', 100, 120)
|
|
|
|
|
|
|
|
var tesseract = createTesseractWorker();
|
|
|
|
|
|
|
|
// tesseract.recognize('http://localhost:7355/westmorland.jpg')
|
|
|
|
tesseract.recognize(canvas, {
|
|
|
|
tessedit_char_blacklist: 'e'
|
|
|
|
})
|
|
|
|
.progress(function(e){
|
|
|
|
console.log('progress', e)
|
|
|
|
})
|
|
|
|
.then(function(e){
|
|
|
|
console.log('result', e)
|
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|