tests/ide_tests/sikuliberemiz.py
changeset 3842 3922024076b3
parent 3839 a466d4468d7a
child 3853 e1cfb03e6582
equal deleted inserted replaced
3841:02fa0f8484d7 3842:3922024076b3
   209             Returns:
   209             Returns:
   210                 Sikuli App class instance
   210                 Sikuli App class instance
   211         """
   211         """
   212         self.ocropts = sikuli.OCR.globalOptions()
   212         self.ocropts = sikuli.OCR.globalOptions()
   213         self.ocropts.dataPath(tessdata_path)
   213         self.ocropts.dataPath(tessdata_path)
   214         self.ocropts.oem(2)
   214         
       
   215         # 0 use legacy Tesseract (not so good, but repeatable)
       
   216         # 1 use RNN Tesseract (better but non-repeatable)
       
   217         # 2 use both
       
   218         self.ocropts.oem(0)
   215         self.ocropts.smallFont()
   219         self.ocropts.smallFont()
   216 
   220 
   217         self.imgnum = 0
   221         self.imgnum = 0
   218         self.starttime = timesec()
   222         self.starttime = timesec()
   219         self.screen = sikuli.Screen()
   223         self.screen = sikuli.Screen()
   316         match = None 
   320         match = None 
   317         matches = sikuli.OCR.readWords(self.r) + sikuli.OCR.readLines(self.r)
   321         matches = sikuli.OCR.readWords(self.r) + sikuli.OCR.readLines(self.r)
   318         for m in matches:
   322         for m in matches:
   319             mText = m.getText().encode('ascii', 'ignore')
   323             mText = m.getText().encode('ascii', 'ignore')
   320             for arg in args:
   324             for arg in args:
   321                 if arg in mText:
   325                 if arg in mText or arg in mText.translate(None, "\"`'|-. "):
   322                     if match is None:
   326                     if match is None:
   323                         match = m
   327                         match = m
   324                     if mText == arg:
   328                     if mText == arg:
   325                         match = m
   329                         match = m
   326                         break
   330                         break