ImageContext not working

140 views
Skip to first unread message

January December

unread,
May 18, 2021, 3:53:24 AM5/18/21
to cloud-vision-discuss
Hi All,

I am getting huge amount of data from the vision api response. For controlling response that I am using ImageContext

1. Disabled OLD text annotation by setting "disableTextAnnotations": true, but still I see it in the response.
2. Also from the response, I would like to get only description field. But it seems i am missing something.
3. It is possible to get only textAnnotation and avoid getting fullTextAnnotation?

Check the json request and attached response and suggest.

Request Json
{
    "requests": [{
            "image": {
                "source": {
                    "imageUri": "gs://<path to file>"
                }
            },
            "features": [{
                    "type": "DOCUMENT_TEXT_DETECTION",
                    "maxResults": 1,
                    "model": "builtin/latest"
                }
            ],
            "imageContext": {
                "languageHints": ["te"
                ],
                "textDetectionParams": {
                    "disableOrientationDetection": false,
                    "disableTextAnnotations": true,
                    "pageFilter": {
                        "paths": ["fullTextAnnotation.text"]
                    },
                    "blockFilter": "",
                    "paragraphFilter": "",
                    "lineFilter": "",
                    "wordFilter": "",
                    "symbolFilter": "",
                    "enableTextDetectionConfidenceScore": false
                }
            }
        }
    ]
}

Regards,
January.

response.json

January December

unread,
May 18, 2021, 5:09:06 AM5/18/21
to cloud-vision-discuss

David Mesa Lopez

unread,
May 31, 2021, 6:56:00 AM5/31/21
to cloud-vision-discuss

Regarding your first concern, the param disableTextAnnotations is working as intended since you are receiving in your response just the textAnnotations and fullTextAnnotation. This parameter is intended to disable the old textAnnotations field but the full_text_annotations will be returned [1].

Regarding the 2 and 3 questions, Google Cloud Vision client library does not have an option for requesting partial responses like the ones you are asking. Nevertheless, I would like to suggest checking [2][3]. Those are similar requests that could help you in order to find a workaround.

Hope this helps!

------

[1] - https://cloud.google.com/vision/docs/reference/rest/v1/ImageContext#:~:text=full_text_annotations%20will%20be%20returned

[2] - https://stackoverflow.com/questions/42663690/how-to-limit-the-text-returned-from-making-a-text-detection-call-to-google-visio

[3] - https://stackoverflow.com/questions/53056817/limiting-the-response-from-google-cloud-vision-api

January December

unread,
Jun 8, 2021, 11:56:45 AM6/8/21
to cloud-vision-discuss
As per this documentation, https://cloud.google.com/vision/docs/reference/rest/v1/ImageContext#TextDetectionParams it should be possible to control  symbolFilter, wordFilter etc. How can I filter out symbols information instead I want only words?

Sway [Cloud Support]

unread,
Jun 9, 2021, 12:31:53 PM6/9/21
to cloud-vision-discuss
As previously advised, there doesn't seem to be a way to do what you're requesting, as previously advised. 

From the document [1] that you've shared, you can try to modify the "wordFilter" parameter. There isn't much information regarding this therefore your results may vary.

January December

unread,
Jun 10, 2021, 12:50:34 AM6/10/21
to cloud-vision-discuss
Hi Sway,  Thanks for your response. ImageContext#textdetectionparams is not working as per the information mentioned in the documentation.  Yesterday  Google support team member has checked the issue and later escalated to Vision API Engineering team. They are looking in to it. Hope they will fix the issue or find out correct parameters and update the documentation. Lets see how it goes.
Regards,
Jan,

Reply all
Reply to author
Forward
0 new messages