2016-11-18 52 views

回答

1

,因爲沒有其他答案現在已經存在了一段時間,我只添加這爲未來的讀者(我還添加了一個賞金):

from googleapiclient.discovery import build 

# ... 

service = build('vision', 'v1', developerKey=API_KEY, cache_discovery=False) 
image_b64 = base64.b64encode(image_bytes).decode() 
return service.images().annotate(body={ 
    'requests': [{ 
     'image': { 
      'content': image_b64 
     }, 
     'features': [{ 
      'type': 'DOCUMENT_TEXT_DETECTION', 
      'maxResults': 5, 
     }] 
    }] 
}).execute() 

這(Python)的樣本明顯不使用的客戶端在問題中,但這是我目前在做這個簡單的OCR的方式。

您可以更改功能或圖像規格以適應您的需求。

相關問題