SikuliX1 icon indicating copy to clipboard operation
SikuliX1 copied to clipboard

OCR(region.text()) is detecting wrong text, when text is underlined

Open avishekhece opened this issue 2 years ago • 7 comments

Hi @RaiMan ,

I tried to get the region of a certain text on the screen using Screen screen = new Screen(); ScreenImage image = screen.capture(); region = image.getRegion(); LoggerUtil.debug("Searching for text on screen. ");

    LoggerUtil.debug("region.text() = " + region.text());
    region=region.findText(strText);

In this case, findText getting failed & I debug the issue and realise that "relocate(wait("\t" + text + "\t", timeout))" the wait method is getting failed, even I tried with image, like Find the text on that image & return the region of the text but still did not worked & on console it is printing empty page !!

Also want to inform you that wherever we use "wait("\t" + text + "\t", timeout)" this, it fails. Please look into this issue. If you have any workaround then please inform me

Please find the image below image

I have been getting stuck into this issue over 1month & due to this tool is almost stop.

avishekhece avatar Nov 02 '23 10:11 avishekhece

What SX version, what system, what Java?

RaiMan avatar Nov 02 '23 14:11 RaiMan

Hi @RaiMan ,

SX version : 'com.sikulix', name: 'sikulixapi', version: '2.0.5' system : Windows 10, 64-bit operating system , I5 processo , 16gb RAM. JAVA : jdk1.8.0_251

Can you please provide me a workaround?

avishekhece avatar Nov 03 '23 05:11 avishekhece

Tried this:

Screen screen = new Screen();
Match match = screen.findText("Product");
match.highlight(2);

while the text Product was visible in the upper left of the screen and it correctly highlighted the text.

RaiMan avatar Nov 03 '23 17:11 RaiMan

Hi @RaiMan ,

This does not work properly, as the string gets by region.text() is completely different than the existing text in UI. What do I need to do as region.text() is not working properly ???

avishekhece avatar Nov 21 '23 08:11 avishekhece

Hi @avishekhece, I think it very hard to find completely when the text has underscore . You can use VietOCR to find text first and apply config to sikuli image

thinhnguyenhcm avatar Nov 28 '23 15:11 thinhnguyenhcm

Apparently there are problems with underscored text in Tesseract, which is used in SikuliX under the hood.

Solutions mentioned in the net are too complex, to be used with SikuliX IDE.

So sorry - no easy solution currently.

RaiMan avatar Jan 14 '24 15:01 RaiMan

I have done the coding in certain way.

On Tue, Nov 28, 2023, 8:42 PM Thinh Nguyen @.***> wrote:

Hi @avishekhece https://github.com/avishekhece, I think it very hard to find completely when the text has underscore . You can use VietOCR to find text first and apply config to sikuli image.png (view on web) https://github.com/RaiMan/SikuliX1/assets/41589802/10cae33e-06c5-4313-b000-7755f4cf6bd9

— Reply to this email directly, view it on GitHub https://github.com/RaiMan/SikuliX1/issues/606#issuecomment-1830045357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIGQCGTYW4C67IMKNCOXPFTYGX5O7AVCNFSM6AAAAAA62UXR3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZQGA2DKMZVG4 . You are receiving this because you were mentioned.Message ID: @.***>

avishekhece avatar Jun 10 '24 08:06 avishekhece