I am trying to get the x and y coordinates of specific text on an image like this. On this image I am trying to detect where X:input Y:input is located which could be anywhere on future images. In this case I would expect it to be around 714, 164, 125, 32 (x, y, width height).
I tried to use Tesseract and Jimp
const worker = await Tesseract.createWorker();
await worker.loadLanguage("eng");
await worker.initialize("eng");
const convertedImage = await image
.grayscale()
.getBufferAsync(Jimp.MIME_PNG);
await worker.setParameters({ tessedit_char_whitelist: "XY012345678" });
const { data } = await worker.recognize(convertedImage);
But I am not sure if anything in data allows me to get the desired result. I am not aware of other libraries that might help me
Updated response
Even with a contrast of 20%, the text was still not getting picked-up. Setting it to 10% worked.
Original response
You will need to crop the text out of the image.
The image is too noisy, even if you convert it to greyscale.
Also, you can set
tessedit_pageseg_modetoPSM.SINGLE_LINE.