Image:
[image: Untitled.png]

Current Code:
#!/usr/bin/env node
const path = require('path');
const sharp = require('sharp');
const { createWorker } = require('tesseract.js');

const [,, imagePath] = process.argv;
const image = path.resolve('C:\\Users\\c\\attendance-system\\server\\
Untitled.png');

console.log(`Processing and recognizing ${image}`);

(async () => {
// Process the image
const processedImage = 'processed.png';
await sharp(image)
.grayscale()
.toFile(processedImage);

// Perform OCR on the processed image
const worker = await createWorker("eng", 1, {
logger: m => console.log(m),
});
await worker.setParameters({
tessedit_char_whitelist: '0123456789',
});
const { data: { text } } = await worker.recognize(processedImage);
console.log("Recognized text:")
console.log(text);
await worker.terminate();
})();

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tesseract-ocr+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/67ea4720-1bbd-4926-9fdb-87eb8f012873n%40googlegroups.com.

Reply via email to