Jerome Wu
6 years ago
2 changed files with 61 additions and 5 deletions
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
# Tesseract.js Examples |
||||
|
||||
### basic |
||||
|
||||
```javascript |
||||
import Tesseract from 'tesseract.js'; |
||||
|
||||
const { TesseractWorker } = Tesseract; |
||||
const worker = new TessearctWorker(); |
||||
|
||||
worker |
||||
.recognize('http://jeroen.github.io/images/testocr.png') |
||||
.then((result) => { |
||||
console.log(result); |
||||
}); |
||||
``` |
||||
|
||||
### with detailed progress |
||||
|
||||
```javascript |
||||
import Tesseract from 'tesseract.js'; |
||||
|
||||
const { TesseractWorker } = Tesseract; |
||||
const worker = new TessearctWorker(); |
||||
|
||||
worker |
||||
.recognize('http://jeroen.github.io/images/testocr.png') |
||||
.progress((p) => { |
||||
console.log('progress', p); |
||||
}) |
||||
.then((result) => { |
||||
console.log(result); |
||||
}); |
||||
``` |
||||
|
||||
### with multiple languages (separate by '+'') |
||||
|
||||
```javascript |
||||
import Tesseract from 'tesseract.js'; |
||||
|
||||
const { TesseractWorker } = Tesseract; |
||||
const worker = new TessearctWorker(); |
||||
|
||||
worker |
||||
.recognize( |
||||
'http://jeroen.github.io/images/testocr.png', |
||||
{ lang: 'eng+chi_tra' } |
||||
) |
||||
.progress((p) => { |
||||
console.log('progress', p); |
||||
}) |
||||
.then((result) => { |
||||
console.log(result); |
||||
}); |
||||
``` |
Loading…
Reference in new issue