def startup():
    if LOGIN_SCREEN_FULL.exists(LOGIN_SCREEN_FULL_IMG):
        pass
    elif WELCOME_SCREEN.exists(WELCOME_SCREEN_IMG):
        logout()
        wait_for_login_screen()
    else:
        raise BadError("Unrecognized Starting Condition")

    Settings.OcrTextRead = True
    Settings.OcrLanguage = "eng" 

    # reset the TextRecognizer
    TR.reset()
    # instantiate it 
    TR.getInstance()

    wl = string.ascii_letters + string.digits
    OCR.setParameter("tessedit_char_whitelist", wl)
    def _set_ocr_parameter(self, ocr_parameter):
        """Sets ocr parameter to either, numeric, alpha or alphanumeric"""
        assert ocr_parameter is not None and len(ocr_parameter) > 0
        numeric = "0123456789"
        alpha_lower = "abcdefghijklmnopqrstuvwxyz"
        alpha_upper = alpha_lower.upper()
        alpha = alpha_lower+alpha_upper
        alphanumeric = alpha+numeric

        if (ocr_parameter == "numeric"):
            ocr_whitelist = numeric
        elif(ocr_parameter == "alpha_lower"):
            ocr_whitelist = alpha_lower
        elif(ocr_parameter == "alpha_upper"):
            ocr_whitelist = alpha_upper
        elif(ocr_parameter == "alphanumeric"):
            ocr_whitelist = alphanumeric
        else:
            ocr_whitelist = ocr_parameter

        OCR.setParameter("tessedit_char_whitelist", ocr_whitelist)
예제 #3
0
    def _set_ocr_parameter(self, ocr_parameter):
        """Sets ocr parameter to either, numeric, alpha or alphanumeric"""
        assert ocr_parameter is not None and len(ocr_parameter) > 0
        numeric = "0123456789"
        alpha_lower = "abcdefghijklmnopqrstuvwxyz"
        alpha_upper = alpha_lower.upper()
        alpha = alpha_lower + alpha_upper
        alphanumeric = alpha + numeric

        if (ocr_parameter == "numeric"):
            ocr_whitelist = numeric
        elif (ocr_parameter == "alpha_lower"):
            ocr_whitelist = alpha_lower
        elif (ocr_parameter == "alpha_upper"):
            ocr_whitelist = alpha_upper
        elif (ocr_parameter == "alphanumeric"):
            ocr_whitelist = alphanumeric
        else:
            ocr_whitelist = ocr_parameter

        OCR.setParameter("tessedit_char_whitelist", ocr_whitelist)
예제 #4
0
# step 3: walk through the lines
grid.setRows(lineCount)
for i in range(lineCount):
    grid.getRow(i).highlight(1)
    break  # uncomment to be faster

# read the textual content of the first 2 rows
Settings.OcrTextRead = True
import org.sikuli.natives.OCR as OCR
import org.sikuli.script.TextRecognizer as TR
TR.getInstance()

digits = "0123456789"
lower = "abcdefghijklmnopqrstuvwxyz"
upper = lower.upper()
chars = lower + upper
all = chars + digits

# read the result message
#OCR.setParameter("tessedit_char_whitelist", chars)
#OCR.setParameter("tessedit_char_whitelist", all)
print foot1.left(150).text()

OCR.setParameter("tessedit_char_whitelist", digits)
print "content of first row"
uprint(grid.getRow(0).text())

OCR.setParameter("tessedit_char_whitelist", "")
print "content of second row"
uprint(grid.getRow(1).text())
예제 #5
0
grid.setRows(lineCount)
for i in range(lineCount):
  grid.getRow(i).highlight(1)
  break # uncomment to be faster

# read the textual content of the first 2 rows
Settings.OcrTextRead=True
import org.sikuli.natives.OCR as OCR
import org.sikuli.script.TextRecognizer as TR
TR.getInstance()

digits = "0123456789"
lower = "abcdefghijklmnopqrstuvwxyz"
upper = lower.upper()
chars = lower+upper
all = chars+digits

# read the result message
#OCR.setParameter("tessedit_char_whitelist", chars)
#OCR.setParameter("tessedit_char_whitelist", all)
print foot1.left(150).text()

OCR.setParameter("tessedit_char_whitelist", digits)
print "content of first row"
uprint(grid.getRow(0).text())

OCR.setParameter("tessedit_char_whitelist", "")
print "content of second row"
uprint(grid.getRow(1).text())