【发布时间】:2020-04-12 20:29:25
【问题描述】:
我想扫描image 文档并从图像中绘制word,我还想获得word count。这可以通过使用Google Vision API 来实现吗?
我没有在他们的文档中看到任何有关字数的相关信息。如果有人以前做到这一点,请帮助我。
【问题讨论】:
标签: python google-vision
我想扫描image 文档并从图像中绘制word,我还想获得word count。这可以通过使用Google Vision API 来实现吗?
我没有在他们的文档中看到任何有关字数的相关信息。如果有人以前做到这一点,请帮助我。
【问题讨论】:
标签: python google-vision
改编自codelabs中的示例:
from google.cloud import vision
def count_words(str):
ls1 = str.split()
return len(ls1)
image_uri = 'gs://cloud-vision-codelab/otter_crossing.jpg'
client = vision.ImageAnnotatorClient()
image = vision.types.Image()
image.source.image_uri = image_uri
response = client.text_detection(image=image)
for text in response.text_annotations:
print(text.description)
print(count_words(text.description))
我的公平建议:也试试其他 OCR 库。
【讨论】: