Rafay Kalim
Rafay Kalim

Reputation: 115

How to fix GCP OCR returning null for bounding poly vertices for text?

Google Cloud Platform's OCR returns the bounding box coordinates fine in most cases, but sometimes it returns NULL which is really annoying because I need the bounding box for it to function properly. I have noticed that this happens usually when the text is close to the left/right edge, but I can't find confirmation of this anywhere. Even the documentation here:

https://developers.google.com/resources/api-libraries/documentation/vision/v1/java/latest/com/google/api/services/vision/v1/model/Vertex.html#getX--

here says that it just returns null for none, but I was wondering if anyone can confirm if this only happens if the box is outside the dimensions of the image, as this would save me a lot of hassle.

Thanks!

Upvotes: 0

Views: 404

Answers (1)

Brendan
Brendan

Reputation: 1060

Vision API uses Protocol Buffers v3

An unset primitive field has a language-defined default value.

If the X or Y value is unset, it means it is 0.

Upvotes: 1

Related Questions