python培训之PaddleOCR库的介绍

发布时间:2023-02-03 09:42:08 人气:129 作者:多测师

  python PaddleOCR库的介绍

  说明

  1、PaddleOCR是基于深度学习的ocr识别库,中文识别精度相当还不错,能够应对大多数文字提取需求。

  2、需要依次安装三个依赖库,shapely库可能会受到系统的影响,出现安装错误。

  安装命令

  pip install paddlepaddle

  pip install shapely

  pip install paddleocr

  代码实现

  ocr = PaddleOCR(use_angle_cls=True,)

  # 输入待识别图片路径

python培训之PaddleOCR库的介绍

  img_path = r"d:\Desktop\4A34A16F-6B12-4ffc-88C6-FC86E4DF6912.png"

  # 输出结果保存路径

  result = ocr.ocr(img_path, cls=True)

  for line in result:

  print(line)

  from PIL import Image

  image = Image.open(img_path).convert('RGB')

  boxes = [line[0] for line in result]

  txts = [line[1][0] for line in result]

  scores = [line[1][1] for line in result]

  im_show = draw_ocr(image, boxes, txts, scores)

  im_show = Image.fromarray(im_show)

  im_show.show()

  以上就是python PaddleOCR库的介绍,希望对大家有所帮助。更多Python学习指路:请关注多测师。https://www.e70w.com/xwzx/




返回列表
在线客服
联系方式

热线电话

17727591462

上班时间

周一到周五

二维码
线