【问题标题】:OCR with Google Cloud Vision python API使用 Google Cloud Vision python API 进行 OCR
【发布时间】:2017-06-30 11:20:56
【问题描述】:

我正在使用 Google Cloud Vision Python API 执行 OCR,以便从文档中提取信息,例如身份证明。有没有办法裁剪图像,只保留文本集中的部分?我尝试使用cropHint,但它只是消除了边界。

我代码中的函数有点像:

def detect_text(path):

    """Detects text in the file."""

    vision_client = vision.Client()

    with io.open(path, 'rb') as image_file:
        content = image_file.read()

    image = vision_client.image(content=content)

    texts = image.detect_text()

【问题讨论】:

    标签: python ocr google-cloud-vision


    【解决方案1】:

    您必须遍历响应并处理边界框的坐标。有关 API 响应的一些示例,请参阅 this page

    【讨论】:

      猜你喜欢
      • 2020-10-22
      • 2023-03-02
      • 1970-01-01
      • 2016-07-24
      • 2020-07-13
      • 1970-01-01
      • 2019-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多