简体   繁体   English

谷歌云愿景与谷歌存储

[英]Google cloud vision with Google storage

I am making a text detection application, using google vision api.我正在制作一个文本检测应用程序,使用谷歌视觉 api。

I want to figure out the way for a OCR detection function be able to load the jpg file.我想弄清楚 OCR 检测的方法 function 能够加载 jpg 文件。

This is a code referance I get from google codelab , but when try to open the url= gs:// like the diagram demonstartes, the error message saying invalid arguments .这是我从google codelab获得的代码参考,但是当尝试打开url= gs://就像图表 demonstartes 时,错误消息说invalid arguments I wonder if I have missed anything??请问我是不是漏了什么??

在此处输入图像描述

Then, i found out that, when it is deployed on cloud functions, google vision will load image from storage .然后,我发现,当它部署在云功能上时,谷歌视觉将从存储中加载图像 but HOW?但是如何? I can not find any relenvant documents giving a detailed process about this.我找不到任何相关文件提供有关此的详细过程。 I am new to the code and bad at finding these instructions.我是代码的新手,不善于找到这些说明。 Does anyone knows how can I successfuly reads/connect to the jpg file?有谁知道我怎样才能成功读取/连接到 jpg 文件? or maybe provide a reference link regarding this?或者可能提供有关此的参考链接? Thank you!谢谢!

在此处输入图像描述

The code on my end is running fine and appears to be correct, I just copied the code and run it through Google Cloud Shell, Be sure to install the Vision API python client library in your cloud shell: pip install --upgrade google-cloud-vision If your intention is to open the the image you can access the image sample provided in the reference you mentioned here: https://storage.cloud.google.com/cloud-samples-data/vision/text/screen.jpg the uri provided in the code is the resource location of the image that is stored in Google Cloud Storage, the link above is the url equivalent of it.我这边的代码运行良好并且看起来是正确的,我只是复制了代码并通过谷歌云 Shell 运行它,一定要在你的云中安装 Vision API python 客户端库 shell: pip install --upgrade google-cloud-vision如果您打算打开图像,您可以访问您在此处提到的参考中提供的图像示例: https://storage.cloud.google.com/cloud-samples-data/vision/text/screen.jpg代码中提供的 uri 是存储在 Google Cloud Storage 中的图像的资源位置,上面的链接是 url 的等价物。

Output: Output: 在此处输入图像描述

I would suggest reading through official documents for more information about the API using client libraries here and although different implementation you can view this OCR usage here .我建议阅读官方文档以获取有关 API 使用客户端库的更多信息,尽管实现方式不同,但您可以在此处查看此 OCR 用法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM