Fuey
Fuey

Reputation: 55

Google Cloud Vision API - client.DetectText is Skipping 0's

I am currently trying to read from a few images the text and it seems that the google api is skipping some 0's.

Here is the code:

Google.Cloud.Vision.V1.Image image = Google.Cloud.Vision.V1.Image.FromFile(imagepath);
        ImageAnnotatorClient client = ImageAnnotatorClient.Create();
        IReadOnlyList<EntityAnnotation> response = client.DetectText(image);
        string test = string.Empty;
        foreach (EntityAnnotation annotation in response)
        {
            if (annotation.Description != null)
            {
                Console.WriteLine(annotation.Description);
                test += Environment.NewLine + annotation.Description;
            }
        }

Here is the image(s) it is attempting:Attempt 1Attempt 2Attempt 3

Are there settings I need to change to make it accept 0's?

Also here is the output from
Attempt 1: https://pastebin.com/dNxRt7QK

results above

Attempt 2: https://pastebin.com/XVZzmtTg

results above

Attempt 3: https://pastebin.com/2kQMiC8h

results above

It's really good at reading everything but it really hates reading 0's. The Deaths specifically in Attempt 2/3.

Edit: Adding in a few results showing this from the google drag-n-drop testing: Attempt 1 Attempt 2

Upvotes: 2

Views: 303

Answers (1)

DavicC
DavicC

Reputation: 96

In order to get better results, it is recommended not to use lossy formats (example of lossy format: JPEG). Using or reducing file sizes for such lossy formats may result in a degradation of image quality, and hence, Vision API accuracy.

The image’s recommended size is 1024 x 768 for the features TEXT_DETECTION and DOCUMENT_TEXT_DETECTION. As an additional note:

The Vision API requires images to be a sufficient size so that important features within the request can be easily distinguished. Sizes smaller or larger than these recommended sizes may work. However, smaller sizes may result in lower accuracy, while larger sizes may increase processing time and bandwidth usage without providing comparable benefits in accuracy. Image size should not exceed 75M pixels (length x width) for OCR analysis.

The items discussed above can be found in this article.

With the code you are using, you can alternately use the DOCUMENT_TEXT_DETECTION feature and select the ones which gives you better results. I see that you are using the code in this link for TEXT_DETECTION. Try using the code in this link for DOCUMENT_TEXT_DETECTION.

In case that issue still persists after the suggested actions, I recommend that you contact Google Cloud Platform Support or create a public issue via this link.

Upvotes: 1

Related Questions