Man*_*a P 1 c# ocr google-cloud-vision
我想使用谷歌云视觉 API 的图像文本检测(OCR)。但我不知道如何获取订阅密钥以及如何在 C# 中进行身份验证和拨打电话。有人可以告诉我执行此操作的步骤吗?顺便说一句,我很新。
I think the question is a bit messed up, so let me take a step back and try to cover the most important things regarding authentication when using the Cloud Vision API.
First of all, the documentation offers a really clear explanation on how to authenticate to the Cloud Vision API, using API keys or Service Accounts. Bear in mind that, as documented in the best practices for authentication in the Google Cloud Platform:
For almost all cases, whether you are developing locally or in a production application, you should use service accounts, rather than user accounts or API keys.
Being this clarified, it is obviously up to you whether to use API keys (I understand this is what you refer to when you mention "subscription keys") or Service Accounts. Here are the main differences that may be relevant for you regarding these two authentication methods:
I hope I have been able to highlight the differences between the alternative authentication methods available. So let's move on to the next topic, authenticating requests:
如果您使用 API 密钥,则只需将 API 密钥附加到您要调用的REST API 方法即可,如下所示:
https://vision.googleapis.com/v1/images:annotate?key=YOUR_API_KEY
Run Code Online (Sandbox Code Playgroud)
在这种情况下,您必须找到一种方法在 C# 中发出 HTTP 请求、解析 JSON 响应等。
如果您正在使用服务帐户(我希望我在答案的第一部分说服您这样做),您将需要按照文档中详细说明的以下步骤进行操作:
GOOGLE_APPLICATION_CREDENTIALS。ImageAnnotatorClient文档)。| 归档时间: |
|
| 查看次数: |
9429 次 |
| 最近记录: |