问题
I am new to use Sikuli for testing with IntelliJ. I am using Sikuli jars from version 1.1.0. I have extracted the libs folder. I have put the tessdata contents(github) inside libs/tessdata folder.I have put the settings for OCR text search, read and also put in environment variable(libs/tessdata).
However the screen.click("text")
is working good. But I found out that it is not working at some cases.
- When the text size is less than the 9 as per word.
- The font color and style is different, the findFailed exception occurs.
- S is taken as 5 sometimes.
- some words are recognized as different.
Can anyone help me what's wrong with this kind of usage?
回答1:
It is a known problem. Just as you found it yourself, small and sometimes "thin" fonts won't be recognized properly. There is not much you can do on the Sikuli side but what you can try is:
- Play with tesseract settings
- Try to apply some image processing techniques to the text areas before you perform the recognition. For example to increase the fond size
- There are few more tricks for when you are just wanting to recognize text in a known area (rather than when you want to find text on the screen), which is to use Sikuli to double click the text and copy its contents to buffer.
回答2:
screen.click("text")
— this wont work, it will search for text.png
.
You can try:
String text ="SEARCH";
screen.findText(text).click();
来源:https://stackoverflow.com/questions/36744457/text-recognition-is-not-working-with-sikuli-for-some-words