This repository was archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageProcessor.js
More file actions
44 lines (36 loc) · 1.31 KB
/
ImageProcessor.js
File metadata and controls
44 lines (36 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// import Tesseract from 'tesseract.js';
// import { createWorker } from 'tesseract.js';
// import * as pyTesseract from 'pytesseract';
// import * as np from 'numpy';
// import { Image } from 'PIL';
var ProcessedText = "erm? what the scallop?"
async function ImgToText(){
//JSTesseract
// const worker = await createWorker({
// logger: m => console.log(m)
// });
// (async () => {
// await worker.loadLanguage('eng');
// await worker.initialize('eng');
// const { data: { text } } = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
// console.log(text);
// await worker.terminate();
// })();
// var ProcessedText = "text"
// return ProcessedText;
// ProcessedText = "text";
// var filename, img1, text;
// jsTesseract.jstesseract.tesseract_cmd = "C:\\Program Files\\Tesseract-OCR\\tesseract.exe";
// filename = "backgroundTileSmall.png";
// img1 = np.array(Image.open(filename));
// text = jsTesseract.image_to_string(img1);
// Tesseract.recognize(
// 'https://tesseract.projectnaptha.com/img/eng_bw.png',
// 'eng',
// { logger: m => console.log(m) }
// ).then(({ data: { text } }) => {
// console.log(text);
// })
console.log(text);
let ProcessedText = "text";
}