Ebru Gulec
Ebru Gulec

Reputation: 723

Google Vision OCR Multiple Text Detection

I'm triying to multiple language text detection with google cloud vision. But I have a problem. If I send the request text detection api endpoint this url;

https://vision.googleapis.com/v1/images:annotate?key=XxxXX

and this body;

{
  "requests": [
    {
      "image": {
        "source": {
          "imageUri": "image_url"
        }
      },
      "features": [
        {
          "type": "DOCUMENT_TEXT_DETECTION",
          "maxResults": 1
        }
      ],
      "ImageContext": {
        "languageHints": [
          "tr", "en"
        ]
      }
    }
  ]
}

I'm getting the this error code;

{
"error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"image_context\" at 'requests[0]': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "type.googleapis.com/google.rpc.BadRequest",
            "fieldViolations": [
                {
                    "field": "requests[0]",
                    "description": "Invalid JSON payload received. Unknown name \"image_context\" at 'requests[0]': Cannot find field."
                }
            ]
        }
    ]
}

}

What is a problem?

Upvotes: 2

Views: 461

Answers (1)

dhauptman
dhauptman

Reputation: 1024

The problem is the field "ImageContext", it should be "imageContext" with lower-case "i".

Upvotes: 1

Related Questions