How can I rescale a buffered image before passing to tesseract OCR for improved accuracy? The image won't be actually drawn anyway since it's just for processing so not sure how this is done. I'm making an electron app and not sure how to upscale the image in this way.
As it is it isn't very accurate as the images I need to process are very small.
const image = 'image.png';
tesser(image);
function tesser(image) {
Tesseract.recognize(image)
.then(function(result){
console.log(result.text)
})
}
Since no-one answered I will post what I found in the end. I could achieve resizing a buffered image using the lib Sharp.
img.onload = resizeImg;
img.src = 'image.png';
function resizeImg() {
this.path = this.path = 'image.png';
sharp(this.path)
.resize(this.width * 2, this.height * 2)
.toBuffer({ resolveWithObject: true })
.then(({ data, info }) => {
//process data
})
}