【问题标题】:What are the correct params for Google Cloud Vision JSON DataGoogle Cloud Vision JSON 数据的正确参数是什么
【发布时间】:2016-04-11 19:00:52
【问题描述】:

我收到此错误:

error": { "code": 400, "message": "Invalid value at 'requests[0].image.content' (TYPE_BYTES), \"000002.jpg\"", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest"

它可能与图像的编码有关,不确定。我正在向 Google 发送一堆 .jpgs。

请注意,这类似于 this question,但它并没有多大帮助 - 没有答案。

这是我的 JSON:

for f in $FILES do echo "Original file name is $f" response=$(curl -v -H "Accept: application/json" -H "Content-type:
application/json" -X POST -d '{"requests":[ { "image":{ "content":"'"$f"'" }, "features":[ { "type":"LABEL_DETECTION", "maxResults":3 } ] }]}' $baseURL) echo $response done

这是我发送的第一张图片。

对造成这种情况的原因有什么想法吗?

【问题讨论】:

    标签: json bash google-cloud-vision


    【解决方案1】:

    您需要发送图像的 base64 编码表示,而不是文件名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 2021-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      相关资源
      最近更新 更多