簡體   English   中英

具有Google Cloud Vision Python API的OCR

[英]OCR with Google Cloud Vision python API

我正在使用Google Cloud Vision Python API執行OCR,以便從文檔中提取信息,例如ID證明。 有沒有一種方法可以裁剪圖像,從而只保留帶有集中文本的部分? 我嘗試使用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()

您將必須遍歷響應並處理邊界框的坐標。 請參閱此頁面以獲取API響應的一些示例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM