Package org.sikuli.core.cv

Examples of org.sikuli.core.cv.TextMap


  static private List<TextMatch> findCandidateMatches(ScreenRegion screenRegion,
      String word, double minScore, boolean firstMatchOnly) {

    ScreenRegion snapshot = screenRegion.snapshot();
    TextMap map = TextMap.createFrom(snapshot.capture());   
    explainer.step(map.getImage(), "text map");

    List<TextMatch> ret = Lists.newArrayList();
    for (WeightedFontModel fontModel : fontModels) {
      logger.trace("test font model => " + fontModel);
      BufferedImage img = TextImageGenerator.create(word,
          fontModel.getFont(), fontModel.getSize(),
          fontModel.getTracking());
      ImageTarget t = new ImageTarget(img);
      t.setMinScore(minScore);
      List<ScreenRegion> matchedRegions = snapshot.findAll(t);

      if (!matchedRegions.isEmpty()) {

        logger.trace("top score = " + matchedRegions.get(0).getScore());
        for (ScreenRegion matchedRegion : matchedRegions) {
          Rectangle r = matchedRegion.getBounds();
          Rectangle s = snapshot.getBounds();
          int localx = r.x - s.x;
          int localy = r.y - s.y;
          if (map.computeTextScore(localx, localy, r.width, r.height) > 0) {
            TextMatch m = new TextMatch(matchedRegion, fontModel);
            ret.add(m);

            fontModel.maxScore = Math.max(fontModel.maxScore,
                matchedRegion.getScore());
View Full Code Here

TOP

Related Classes of org.sikuli.core.cv.TextMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.