Example #1
0
def get_text(img, offset=0):
    text = pretreatment.get_text(img, offset)
    text = cv2.cvtColor(text, cv2.COLOR_BGR2GRAY)
    text = text / 255.0
    h, w = text.shape
    text.shape = (1, h, w, 1)
    return text
Example #2
0
def get_text(img, offset=0):
    text = pretreatment.get_text(img, offset)
    text = text[..., 0] * 0.114 + text[..., 1] * 0.587 + text[
        ..., 2] * 0.299  # text = cv2.cvtColor(text, cv2.COLOR_BGR2GRAY)
    text = text / 255.0
    h, w = text.shape
    text.shape = (1, h, w, 1)
    return text
Example #3
0
def get_text(img, offset=0):
    '''
    得到图片中文字的部分
    :param img: 原始图像
    :param offset:
    :return: 文字部分的灰度图像
    '''
    text = pretreatment.get_text(img, offset)
    text = text[..., 0] * 0.114 + text[..., 1] * 0.587 + text[..., 2] * 0.299
    text = text / 255.0
    h, w = text.shape
    text.shape = (1, h, w, 1)
    return text