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.
30 lines
1006 B
30 lines
1006 B
<canvas id="c"></canvas> |
|
<script type="text/javascript" src="./tesseract/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) |
|
|
|
|
|
Tesseract.workerUrl = location.protocol+'//'+location.host+'/tesseract/tesseract.worker.js' |
|
|
|
// Tesseract.detect(canvas) |
|
// Tesseract.recognize('http://localhost:7355/westmorland.jpg') |
|
// Tesseract.recognize(canvas, { tessedit_char_blacklist: 'e' }) |
|
Tesseract.recognize(canvas) |
|
.progress(function(e){ |
|
console.log('progress', e) |
|
}) |
|
.then(function(e){ |
|
console.log('result', e) |
|
}) |
|
</script> |