Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--model_name",
                        help="model name",
                        type=str,
                        default='conv-lite-fc')
    parser.add_argument("--model_epoch",
                        type=int,
                        default=None,
                        help="model epoch")
    parser.add_argument("-f", "--file", help="Path to the image file")
    parser.add_argument(
        "-s",
        "--single-line",
        default=False,
        help="Whether the image only includes one-line characters",
    )
    args = parser.parse_args()

    ocr = CnOcr(model_name=args.model_name, model_epoch=args.model_epoch)
    if args.single_line:
        res = ocr.ocr_for_single_line(args.file)
    else:
        res = ocr.ocr(args.file)
    logger.info("Predicted Chars: %s", res)
Exemplo n.º 2
0
 def __init__(self, parent=None):
     super(GUIMainWin, self).__init__(parent)
     # Basic Setups
     self.setupUi(self)
     self.appExceptionHandler = ExceptHookHandler(
         self,
         logFile=os.path.join(os.path.expanduser('~'),
                              "ArknightsRecruitmentHelper", "log.txt"))
     self.setWindowTitle(globalVersion)
     # Key Initializations
     self.handle = 0
     self.initializeHandleSelector()
     self.tagImageSceneList = [
         QGraphicsScene(),
         QGraphicsScene(),
         QGraphicsScene(),
         QGraphicsScene(),
         QGraphicsScene()
     ]
     self.tagTypeList = ["", "", "", "", ""]
     # Handler Connections
     self.handleSelectorComboBox.activated[str].connect(self.onHandleSelect)
     self.updateHandleSelectorListButton.clicked.connect(
         self.initializeHandleSelector)
     self.manualRecognizeAndAnalyzeButton.clicked.connect(
         self.recognizeAndAnalyze)
     self.updateDataButton.clicked.connect(self.updateData)
     self.ocrInstance = CnOcr(model_name='conv-lite-fc')
Exemplo n.º 3
0
 def __init__(self, font='HYZiKuTangChangLinTiW-2.ttf'):
     self.img_font = ImageFont.truetype(font, 60)
     self.fill_color = "#000000"
     self.ocr = CnOcr()
     if not os.path.isdir('jpg'):
         os.mkdir('jpg')
     pass
Exemplo n.º 4
0
def pathCallBack():
    # , ('All Files', '*')
    filePath = filedialog.askopenfilename(title='Select picture to OCR', filetypes=[('PNG', '*.png'), ('JPG', '*.jpg'),('JPEG', '*.jpeg'), ('bmp', '*.bmp')])
    if (filePath != ''):
        strPath.set(filePath)

        ocr = CnOcr()
        img_fp = ''
        # img_fp = 'D://download/multi-line_cn1.png'
        img_fp = filePath

        img = mx.image.imread(img_fp, 1)

        res = ocr.ocr(img)
        # print("Predicted Chars:", res)

        # print(type(res))
        strResult = ""

        for s in res:
            strResult = strResult + ''.join('%s' % id for id in s) + "\n"

        txtResult.delete(0.0, tk.END)
        txtResult.insert(tk.INSERT, strResult)
        txtResult.update()
Exemplo n.º 5
0
    def __init__(self, path: str, show_img: bool = False):
        self.__ext = {'jpg', 'jpeg'}
        self.__ocr = CnOcr(model_name='densenet-lite-gru',
                           cand_alphabet=string.digits,
                           name=path)
        self.__std = CnStd(name=path)
        self.__info_dict = {}
        self.__dup_name_dict = {}

        # 先对路径进行替换
        path = self.__format_path(path)

        # 根据传入的路径判断操作
        if os.path.isdir(path) or os.path.isfile(path):
            files = [self.__format_path(os.path.join(path, f)) for f in os.listdir(path) if
                     (os.path.isfile(os.path.join(path, f)) and self.__is_image(f))] \
                if os.path.isdir(path) \
                else [path]
            for file in tqdm(files):
                self.__handle_info(
                    file,
                    self.__ocr_number(
                        self.__std_number(self.__cutter(file, show_img))))
        else:
            print(f'获取数据错误,“{path}”既不是文件也不是文件夹')
Exemplo n.º 6
0
def getOCR(img):
    """使用CnOcr识别图片内容,按行输出结果至res列表的函数
    """
    global result_str, result
    buffer = QtCore.QBuffer()
    buffer.open(QtCore.QBuffer.ReadWrite)
    img.save(buffer, "PNG")
    pil_img = Image.open(io.BytesIO(buffer.data()))
    image_array = np.array(pil_img)
    buffer.close()

    ocr = CnOcr()
    res = ocr.ocr(image_array)

    try:
        # 拼接字符串并保存至results列表
        result_str = []
        for iter_item in res:
            result_str.append(''.join(iter_item))
        result = "\n".join(result_str)

    except Exception as e:
        print(f"INFO: Unable to read text from image, did not copy")
        notify(f"Unable to read text from image, did not copy")

    if result:
        pyperclip.copy(result)
        print(f'INFO: Copied "{result}" to the clipboard')
        notify(f'Copied "{result}" to the clipboard')
    else:
        print(f"INFO: Unable to read text from image, did not copy")
        notify(f"Unable to read text from image, did not copy")
Exemplo n.º 7
0
class dyOCR():
    def __init__(self):
        from cnocr import CnOcr
        self.ocr = CnOcr()

    def resFromFilePath(self, fp):
        get = self.ocr.ocr(fp)
        if get == []:
            return "-1 暂时不能识别"
        get = "".join(get[0])
        get = get.replace("o", "0")
        get = get.replace("O", "0")
        return get

    def resFromB64(self, b64):
        img_data = base64.b64decode(b64)
        # nparr = np.fromstring(img_data, np.uint8)
        nparr = np.frombuffer(img_data, np.uint8)
        img_np = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
        get = self.ocr.ocr(img_np)
        if get == []:
            return "-1 暂时不能识别"
        get = "".join(get[0])
        get = get.replace("o", "0")
        get = get.replace("O", "0")
        return get
Exemplo n.º 8
0
    def get_list(self):
        std=CnStd()
        
        ocr=CnOcr()
        ocr._model_name='conv-lite-fc'
        print(ocr._model_name)
        ocr_res2=ocr.ocr(img_fp=self.filepath)
        box_info_list=std.detect(self.filepath,pse_threshold=0.7,pse_min_area=150,context='gpu',height_border=0.10)
        image=Image.open(self.filepath)
        fontstyle=ImageFont.truetype('./simhei.ttf',13,encoding='utf-8')
        draw=ImageDraw.Draw(image)
        for box_info in box_info_list:
            print('a')
            print('a')
            print(box_info)
            info_box=box_info['box']
            crp_img=box_info['cropped_img']
            ocr_res1=ocr.ocr_for_single_line(crp_img)
            
            print('result: %s' % ''.join(str(ocr_res1)))
            x1,y1=info_box[0,0],info_box[0,1]
            x2,y2=info_box[1,0],info_box[1,1]
            x3,y3=info_box[2,0],info_box[2,1]
            x4,y4=info_box[3,0],info_box[3,1]
            

            draw.polygon([(x1,y1),(x4,y4),(x3,y3),(x2,y2)],outline=(255,0,0))
            draw.text((x4,y4),str(ocr_res1),(200,0,0),font=fontstyle)
        image.show()
        print(ocr_res2)
        return box_info_list
Exemplo n.º 9
0
def aaa(request):
    if request.method == 'GET':
        return render(request, 'aaa.html')
    file = request.FILES.get('file')
    b = b''
    for c in file.chunks():
        b += c
    try:
        ocr = CnOcr()
    except:
        pass
    sep = ','
    img_data = plt.imread(BytesIO(b), "png")
    # print(type(img_data))
    # print(img_data.shape)
    image = img_data[:, :, :3]
    # print(image.shape)
    image = (image * 255).astype(np.int)
    try:
        res = ocr.ocr_for_single_line(image)
        msg = sep.join(res).replace(',', '')
        data = {'code': 200, 'msg': msg}
        return JsonResponse(data)
    except:
        msg = '图片名含有非转义字符,建议使用数字字母的形式'
        data = {'code': 400, 'msg': msg}
        return JsonResponse(data)
Exemplo n.º 10
0
def OCR():
    ocr = CnOcr()
    QR_Image = getScreenImage()
    #res = ocr.ocr_for_single_line(QR_Image)
    res = ocr.ocr(QR_Image)
    print("Predicted Chars:", res)
    easygui.msgbox(res)
Exemplo n.º 11
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-f", "--file", help="Path to the CAPTCHA image file")
    args = parser.parse_args()

    ocr = CnOcr()
    res = ocr.ocr_for_single_line(args.file)
    print("Predicted Chars:", res)
Exemplo n.º 12
0
def test_cand_alphabet():
    img_fp = os.path.join(example_dir, 'hybrid.png')

    ocr = CnOcr(cand_alphabet=NUMBERS)
    pred = ocr.ocr(img_fp)
    pred = [''.join(line_p) for line_p, _ in pred]
    print("Predicted Chars:", pred)
    assert len(pred) == 1 and pred[0] == '012345678'
Exemplo n.º 13
0
def cnocr_ocr(pic_path):
    from cnocr import CnOcr
    ocr = CnOcr()
    res = ocr.ocr(pic_path)
    for i in res[:-1]:
        for j in i[0]:
            print(j, end='')
        print()
    for i in res[-1][0]:
        print(i, end='')
Exemplo n.º 14
0
 def __init__(self, font='shaoq.woff'):
     self.img_font = ImageFont.truetype(font, 60)
     self.fill_color = "#000000"
     self.font = TTFont('shaoq.woff')
     self.keys = list(key for key in self.font['glyf'].keys()
                      if key.startswith('uni'))
     self.ocr = CnOcr()
     if not os.path.isdir('jpg'):
         os.mkdir('jpg')
     pass
Exemplo n.º 15
0
def extract_img(path: str):
    ocr = CnOcr()
    res = ocr.ocr(path)
    lines = []
    for obj in res:
        line = "".join(obj[0])
        lines.append(line)
    data = "\n".join(lines)
    os_remove(path)
    return data
Exemplo n.º 16
0
def ocr_image(fname):
    print('OCR %s' % fname)

    global _cnocr
    if _cnocr is None:
        _cnocr = CnOcr()

    res = _cnocr.ocr(fname)
    text = '\n'.join([''.join(t) for t in res])

    return text
Exemplo n.º 17
0
def cnocr_ocr(pic_path):
    from cnocr import CnOcr
    ocr = CnOcr()
    res = ocr.ocr(pic_path)
    for r in res[:-1]:
        for c in r:
            print(c, end='')
        print()
    for r in res[-1]:
        for c in r:
            print(c, end='')
Exemplo n.º 18
0
def start_engine(model_path='models'):
    if OCR_MODEL_NAME + '.zip' in os.listdir(
            model_path) and STD_MODEL_NAME + '.zip' in os.listdir(model_path):
        print('初始化模型中...')

        ocr_root = os.path.join(data_dir(mode='cnocr'), ocr_version)
        ocr_root = os.path.join(ocr_root, OCR_MODEL_NAME)
        os.makedirs(ocr_root, exist_ok=True)
        ocr_zip_file_path = os.path.join(ocr_root, OCR_MODEL_NAME + '.zip')
        shutil.copyfile(os.path.join('models', OCR_MODEL_NAME + '.zip'),
                        ocr_zip_file_path)
        with zipfile.ZipFile(ocr_zip_file_path) as zf:
            zf.extractall(os.path.dirname(ocr_root))
        os.remove(ocr_zip_file_path)

        std_root = os.path.join(data_dir(mode='cnstd'), std_version)
        std_root = os.path.join(std_root, STD_MODEL_NAME)
        os.makedirs(std_root, exist_ok=True)
        std_zip_file_path = os.path.join(std_root, STD_MODEL_NAME + '.zip')
        shutil.copyfile(os.path.join('models', STD_MODEL_NAME + '.zip'),
                        std_zip_file_path)
        with zipfile.ZipFile(std_zip_file_path) as zf:
            zf.extractall(os.path.dirname(std_root))
        os.remove(std_zip_file_path)

        ocr_core = CnOcr()
        std_core = CnStd()

        print('初始化完成')
        return ocr_core, std_core
    else:
        print('初始化失败,未找到预加载模型')
        return None
Exemplo n.º 19
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-f", "--file", help="Path to the image file")
    parser.add_argument(
        "-s",
        "--single-line",
        default=False,
        help="Whether the image only includes one-line characters")
    args = parser.parse_args()

    ocr = CnOcr()
    if args.single_line:
        res = ocr.ocr_for_single_line(args.file)
    else:
        res = ocr.ocr(args.file)
    print("Predicted Chars:", res)
Exemplo n.º 20
0
class FTC(object):
    # font_to_chinese
    def __init__(self, font='HYZiKuTangChangLinTiW-2.ttf'):
        self.img_font = ImageFont.truetype(font, 60)
        self.fill_color = "#000000"
        self.ocr = CnOcr()
        if not os.path.isdir('jpg'):
            os.mkdir('jpg')
        pass

    def make_all_font_img(self):
        img = Image.new('RGB', (70 * 20, 80), color='white')
        draw = ImageDraw.Draw(img)
        draw.text((0, 0), u'abcdefghigklmnopqrstuvwxyz', font=self.img_font, fill=self.fill_color)
        img.show()
        img.save('jpg/1.jpg')

    def make_img(self):
        img = Image.new('RGB', (140, 80), color='white')
        draw = ImageDraw.Draw(img)
        draw.text((0, 0), chr(0xe41b), font=self.img_font, fill=self.fill_color)
        # img.show()
        # img.save('jpg/1.jpg')
        # print(pytesseract.image_to_string(img, lang='chi_sim'))
        pass

    def ret_key_font(self):
        self.make_all_font_img()
        res = self.ocr.ocr('jpg/1.jpg')
        return res
Exemplo n.º 21
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--model_name",
                        help="model name",
                        type=str,
                        default='conv-lite-fc')
    parser.add_argument("--model_epoch",
                        type=int,
                        default=None,
                        help="model epoch")
    parser.add_argument("-f", "--file", help="Path to the image file or dir")
    parser.add_argument(
        "-s",
        "--single-line",
        default=False,
        help="Whether the image only includes one-line characters",
    )
    args = parser.parse_args()

    ocr = CnOcr(model_name=args.model_name, model_epoch=args.model_epoch)
    ocr_func = ocr.ocr_for_single_line if args.single_line else ocr.ocr
    fp_list = []
    if os.path.isfile(args.file):
        fp_list.append(args.file)
    elif os.path.isdir(args.file):
        fn_list = glob.glob1(args.file, '*g')
        fp_list = [os.path.join(args.file, fn) for fn in fn_list]

    for fp in fp_list:
        res = ocr_func(fp)
        logger.info('\n' + '=' * 10 + fp + '=' * 10)
        res = [''.join(line_p) for line_p in res]
        logger.info('\n' + '\n'.join(res))
Exemplo n.º 22
0
class textRecongiser:
    ocr = CnOcr()

    def __init__(self, file_name, temp_save_path):
        f_suffix = file_name.split('.')[-1]
        self.file_name = file_name.replace('.' + f_suffix, '')

        self.temp_pic_dir = temp_save_path
        self.output_text_dir = subtile_dir

    def gen_subtitle(self):
        total_content = []
        files = os.listdir(self.temp_pic_dir)
        for f in files:
            t = self.ocr.ocr(self.temp_pic_dir + '/' + f)
            for tt in t:
                line = ''.join(tt) + '\n'
                total_content.append( line )

        # write into file
        with open(self.output_text_dir + self.file_name + '.txt', 'w', encoding='utf8') as f:
            f.write(self._processContent(total_content))
            f.close()

    def  _processContent(self, content_array):
        final_content = ''
        t_content_array = []
        for c in content_array:
            if c not in t_content_array:
                t_content_array.append(c)

        # print(t_content_array)
        for t in t_content_array:
            final_content += t
        return final_content.strip('\n')
Exemplo n.º 23
0
def predict(model_name, pretrained_model_fp, context, img_file_or_dir,
            single_line):
    ocr = CnOcr(model_name=model_name,
                model_fp=pretrained_model_fp,
                context=context)
    ocr_func = ocr.ocr_for_single_line if single_line else ocr.ocr
    fp_list = []
    if os.path.isfile(img_file_or_dir):
        fp_list.append(img_file_or_dir)
    elif os.path.isdir(img_file_or_dir):
        fn_list = glob.glob1(img_file_or_dir, '*g')
        fp_list = [os.path.join(img_file_or_dir, fn) for fn in fn_list]

    for fp in fp_list:
        start_time = time.time()
        logger.info('\n' + '=' * 10 + fp + '=' * 10)
        res = ocr_func(fp)
        logger.info('time cost: %f' % (time.time() - start_time))
        logger.info(res)
        if single_line:
            res = [res]
        for line_res in res:
            preds, prob = line_res
            logger.info('\npred: %s, with probability %f' %
                        (''.join(preds), prob))
Exemplo n.º 24
0
def txtOcr():
    if request.method == 'POST':
        file = request.files['file']
        if file and allowed_file(file.filename):
            filename = secure_filename(''.join(lazy_pinyin(file.filename)))
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            file_url = url_for('uploaded_file', filename=filename)
            import mxnet as mx
            from cnocr import CnOcr
            ocr = CnOcr()
            img_fp = os.path.join(app.config['UPLOAD_FOLDER'], filename)
            img = mx.image.imread(img_fp, 1)
            res = ocr.ocr(img)
            print("Predicted Chars:", res)
            return html + '<br><img src=' + file_url + '><p>预测结果如下:' + str(
                res) + '</p>'
    return html
Exemplo n.º 25
0
def orc_text(path_image):
    ocr = CnOcr()
    image = cv2.imread(path_image, cv2.IMREAD_GRAYSCALE)
    height_image, width_image = image.shape
    _, binary_image = cv2.threshold(image, 150, 255, cv2.THRESH_BINARY_INV)
    height_projection = get_horizontal_projection(binary_image)
    text_lines = get_text_lines(height_projection)
    text_list = []
    for line_index, text_line in enumerate(text_lines):
        text_line_image = binary_image[text_line[0]:text_line[1],
                                       0:width_image]
        vertical_projection = get_vertical_projection(text_line_image)
        text_words = get_text_word(vertical_projection)
        text_line_word_image = image[text_line[0]:text_line[1],
                                     text_words[0][0]:text_words[-1][1]]
        res = ocr.ocr_for_single_line(text_line_word_image)
        text_list.append(''.join(res))
    return text_list
def extract_content(save_dir_path):
    std = CnStd()
    cn_ocr = CnOcr()

    base_path = os.path.abspath(os.path.dirname(__file__))
    pic_base_dir = os.path.join(base_path, "received")
    pic_path_list = (glob.glob(os.path.join(pic_base_dir, "*.png")) +
                     glob.glob(os.path.join(pic_base_dir, "*.jpg")) +
                     glob.glob(os.path.join(pic_base_dir, "*.jpeg")))

    workbook = xlwt.Workbook()
    for index, pic_path in enumerate(pic_path_list):
        sheet = workbook.add_sheet('sheet{}'.format(index),
                                   cell_overwrite_ok=True)
        box_info_list = std.detect(pic_path)
        for box_info in box_info_list:
            x_list, y_list = [], []
            for (x, y) in box_info['box']:
                x_list.append(x)
                y_list.append(y)
            top, bottom, left, right = min(y_list), max(y_list), min(
                x_list), max(x_list)
            top_row, bottom_row, left_column, right_column = int(
                top // 80), int(bottom // 80), int(left // 60), int(right //
                                                                    60)
            cropped_img = box_info['cropped_img']  # 检测出的文本框
            ocr_res = ''.join(cn_ocr.ocr_for_single_line(cropped_img))
            try:
                logger.info(
                    "top_row:{}, bottom_row:{}, left_column:{}, right_column:{}, ocr_res:{}",
                    top_row,
                    bottom_row,
                    left_column,
                    right_column,
                    ocr_res,
                    feature="f-strings")
                sheet.write_merge(top_row, bottom_row, left_column,
                                  right_column, ocr_res)
            except Exception as e:
                print(e)

    xls_base_dir = os.path.join(base_path, save_dir_path)
    xls_path = os.path.join(xls_base_dir, "res.xls")
    workbook.save(xls_path)
Exemplo n.º 27
0
    def __init__(self):
        super(picture, self).__init__()

        self.resize(350, 350)
        self.setWindowTitle("图片转文字")

        self.label = QLabel(self)
        # self.label.setText("显示图片")
        self.label.setScaledContents(True)
        self.label.setFixedSize(300, 200)
        self.label.move(25, 60)

        self.label.setStyleSheet(
            "QLabel{background:white;}"
            "QLabel{color:rgb(300,300,300,120);font-size:10px;font-weight:bold;font-family:宋体;}"
        )

        btn = QPushButton(self)
        btn.setText("打开图片")
        btn.move(135, 20)
        btn.clicked.connect(self.openimage)

        self.label_text = QLabel(self)
        self.label_text.setFixedSize(300, 30)
        self.label_text.move(25, 270)
        self.label_text.setTextInteractionFlags(
            Qt.TextSelectableByMouse)  ###可复制

        self.label_wait = QLabel(self)
        self.label_wait.setFixedSize(300, 30)
        self.label_wait.move(25, 300)
        # 标签1的背景填充更改为True,否则无法显示背景
        self.label_wait.setAutoFillBackground(True)
        # # 实例化背景对象,进行相关背景颜色属性设置
        # palette = QPalette()
        # palette.setColor(QPalette.Window, Qt.green)
        # # 标签1加载背景
        # self.label_wait.setPalette(palette)
        # 设置文本居中显示
        self.label_wait.setAlignment(Qt.AlignCenter)
        self.label_wait.setText('tips:识别过程可能会卡住,需几秒到几十秒不等')

        self.std = CnStd()
        self.cn_ocr = CnOcr()
Exemplo n.º 28
0
def multLineOcr(request):
    imgs = request.POST.get("img")
    img = imgs.replace(" ", "+")

    res = base64.b64decode(img)
    # res = base64.urlsafe_b64encode(img)
    nparr = np.fromstring(res, np.uint8)
    img = cv2.imdecode(nparr, cv2.COLOR_BGR2RGB)
    imgb = img
    img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)

    # cv2.imwrite("img.png", imgb)

    ocr = CnOcr()
    res = ocr.ocr(img)

    return HttpResponse(
        json.dumps(res)
    )
Exemplo n.º 29
0
def ocr():
    if 'file' not in request.files:
        return jsonify(code=-1, message='no file error'), 400
    file = request.files['file']

    _uuid = str(uuid.uuid1())
    file_name = '/tmp/ocr/' + _uuid
    file.save(file_name)

    ocr = CnOcr(name=_uuid)
    std = CnStd(name=_uuid)
    box_info_list = std.detect(file_name)

    lines = []
    for box_info in box_info_list:
        cropped_img = box_info['cropped_img']  # 检测出的文本框
        ocr_res = ocr.ocr_for_single_line(cropped_img)
        lines.append(''.join(ocr_res))
    return jsonify(code=0, message='ok', data=lines)
Exemplo n.º 30
0
    def cn_ocr(self, _range, delay_time=5):
        """
        cn ocr识别数字
        :param delay_time: ocr识别延迟时间
        :param _range: 验证码截图区域坐标(左x,左y,右x,右y)
        :return: 识别到的数字
        """
        global sms_code
        self.get_code_pic(_range)

        cn_ocr = CnOcr(model_name="conv-lite-fc",
                       context="cpu",
                       root="conv-lite-fc")
        ret = cn_ocr.ocr("ios_code_pic.png")
        result = ""
        for v in ret:
            result += "".join(v)

        find_all = re.findall(r'\'[\d]{6}\'', str(result))
        if len(find_all) != 1:
            find_all = re.findall(r'([\d]{6})[\u3002]', str(result))
        if len(find_all) != 1:
            find_all = re.findall(r'(您的验证码为[\d]{6})', str(result))

        # 识别结果
        self.logger.info("CnOCR识别结果:" + result)

        if len(find_all) == 1:
            code = find_all[0].strip("'")

            if sms_code == code:
                self.logger.info("暂未获取到最新验证码,%d秒后重试" % delay_time)
                time.sleep(delay_time)
                return self.cn_ocr(_range, delay_time)
            else:
                sms_code = code

            return code
        else:
            self.logger.info("暂未获取到最新验证码,%d秒后重试" % delay_time)
            time.sleep(delay_time)
            return self.cn_ocr(_range, delay_time)