使用 Google 云视觉 API

Using Google Cloud Vision API

我正在尝试使用 Google Cloud Vision API,但遇到了一些问题。让我解释一下我采取的步骤以及我面临的问题。我 运行 在 Windows 10.

中编写此代码
  1. 下载并安装"GoogleCloudSDKInstaller"。
  2. gcloud auth application-default login激活我的登录 凭据
  3. 使用 this 代码到 运行 人脸检测器,用于图像 在我的本地系统中。
  4. cd 到图像所在的文件夹
  5. 然后运行下面的代码:

    python detect_face.py "image.jpg"

但是我收到这个错误:

raise EnvironmentError('Project was not passed and could not be ' OSError: Project was not passed and could not be determined from the environment.

谁能告诉我为什么会遇到这个问题?

我正在使用 Google Vision API,但在 C# 中使用 Visual Studios 2017,我需要将环境变量设置为 GOOGLE_DEFAULT_CREDENTIALS。 你可能遇到了这个问题,试试上网看看怎么设置吧