def get_result(file_name):
    image = cv2.imread(file_name)
    # 각각의 이미지를 chars변수에 담음
    chars = utils.extract_chars(image)
    result_string = ""

    for char in chars:
        # 하나하나의 숫자 혹은 기호
        matched = check(utils.resize20(char[1]))

        # 숫자
        if matched < 10:
            result_string += str(int(matched))
            continue
        # 기호
        if matched == 10:
            matched = '+'
        elif matched == 11:
            matched = '-'
        elif matched == 12:
            matched = '*'

        result_string += matched

    return result_string
示例#2
0
def get_result(file_name):
    image = cv2.imread(file_name)
    chars = utils.extract_chars(image)
    result_string = ""
    for char in chars:
        matched = check(utils.resize20(char[1]), train, train_labels)
        if matched < 10:
            result_string += str(int(matched))
            continue
        if matched == 10:
            matched = '+'
        elif matched == 11:
            matched = '-'
        elif matched == 12:
            matched = '*'
        result_string += matched
    return result_string
示例#3
0
文件: run.py 项目: jjoooyi/python
def get_result(file_name):
    image = cv2.imread(file_name)
    # 들어온 캐릭터를 왼쪽부터 각각의 이미지를 잘라 저장
    chars = utils.extract_chars(image)
    result_str = ''
    for char in chars:
        # 이미지가 분류된 값
        matched = check(utils.resize20(char[1]), train, train_labels)
        if matched < 10:
            result_str += str(int(matched))
            continue
        if matched == 10:
            matched = '+'
        elif matched == 11:
            matched = '-'
        elif matched == 12:
            matched = '*'
        result_str += matched
    return result_str
示例#4
0
def get_result(file_name):
    image = cv2.imread(file_name)
    chars = utils.extract_chars(image)
    result_string = ""  # 문자를 저장할 변수

    for char in chars:
        matched = check(utils.resize20(char[1]), train,
                        train_labels)  # char[1] : 하나하나의 숫자 이미지 array값.
        if matched < 10:  # 숫자인 경우
            result_string += str(int(matched))
            continue  # 숫자면 추가하고 다시 체크 반복.
        if matched == 10:
            matched = '+'
        elif matched == 11:
            matched = '-'
        elif matched == 12:
            matched = '*'
        result_string += matched
    return result_string
示例#5
0
def get_result(file_name):# 파일이 들어오면
    image = cv2.imread(file_name)
    chars = utils.extract_chars(image)# 각각의 이미지를 왼쪽부터 담고
    result_string = ""
    for char in chars:
        # 이미지를 400으로 쭉 늘어트리고 매치되는 데이터를 담음
        matched = check(utils.resize20(char[1]), train, train_labels)
        if matched < 10:
            # 숫자를 왼쪽부터 차례로 붙일 수 있게
            result_string += str(int(matched))
            continue
            
        if matched == 10:
            matched = "+"

        elif matched == 11:
            matched = "-"

        elif matched == 12:
            matched = "*"

        result_string += matched
    return result_string