2024-09-28 23:43:43 发布
网友
我想扫描一个image文档并将图像中的word绘制成图形,我还想得到word count。通过使用Google Vision API这可能吗
image
word
word count
Google Vision API
我在他们的文档中没有看到任何有关字数统计的信息。如果有人以前做到过,请帮助我
改编自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库一个机会
改编自codelabs中的示例:
我的建议是:也给其他OCR库一个机会
相关问题 更多 >
编程相关推荐