Beispiel #1
0
 def _findText(self, screenshot, text, match=1.0, area=(0.0, 0.0, 1.0, 1.0)):
     top, left = fmbtgti._intCoords(area[:2], screenshot.size())
     bottom, right = fmbtgti._intCoords(area[2:], screenshot.size())
     threshold = int(match*100)
     result = self._matcher.match(
         screenshot = screenshot.filename(),
         icon = text,
         threshold = threshold,
         method = "OCR",
         searcharea = _area2searcharea(screenshot, area),
         resultimage = "")
     if result.result[0]/100.0 < match:
         return []
     else:
         return [fmbtgti.GUIItem(
             "OCR text",
             _resultbbox2bbox(result.bbox[0]),
             screenshot = screenshot.filename(),
             ocrFind = text,
             ocrFound = "match:%.2f/%.2f" % (result.result[0]/100.0, match))]
Beispiel #2
0
def _area2searcharea(screenshot, area):
    top, left = fmbtgti._intCoords(area[:2], screenshot.size())
    bottom, right = fmbtgti._intCoords(area[2:], screenshot.size())
    return (top, left, bottom, right)