← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #690954]: [2.0.4] findText("string") not working --- try with findWord, findWords, findLine, findLines

 

Question #690954 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/690954

    Status: Open => Answered

RaiMan proposed the following answer:
I am sorry for the delay - should have gone deeper into the SikuliX implementation from the beginning.
findText() or find("some text") are simply based on a "stupid" implementation (my bad ;-).
I will improve it with the 2.0.5.

Until then try to solve your problem with findWord, findWords, findLine
and findLines features.

Here a Java sample:

      Region region = new Region(0, 0, 300, 300);
      try {
        String fImg = new File("testImage/image").getCanonicalPath();
        Match match = region.find(fImg);
        List<Match> lines = match.findLines();
        for (Match m : lines) {
          System.out.println(m.getText());
        }
        match.findLine("API").highlight(2);
        List<Match> words = match.findWords();
        for (Match m : words) {
          System.out.println(m.getText());
        }
        match.findWord("API").highlight(2);
      } catch (Exception e) {
        System.out.println("Error" + e.getMessage());
      }

a "line" in this sense is a row of text in the image, that is seen by Tesseract as a line (same background color, same base line, ...).
a "word" is some text of characters surrounded by non-text (like white space).

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.