3

This is my first question here so I'll try to be as relevant as possible. I am interested in using Cloud Vision to process some documents, as I need OCR capabilities. I also happen to need bar code reading, which I currently have implemented using ZXing.

I stumbled upon the BARCODE blocktype in the OCR ( https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#BlockType ) but I did not manage to produce such a block, even with an image containing only a bar code.

Hence the question: is the feature implemented, and if so, how can we get it to work ? Thank you for your time !

Note:

I have seen those related questions:

But they do not satify me as I need both the barcode reading and the OCR, and I am doing work on backend only, no user involved.

Edit:

I have tried for example with this image :

~/Pictures                                                                                                                                                                                                                                                                    
» gcloud ml vision detect-text barcode.jpg | grep -i "blocktype"
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",

~/Pictures                                                                                                                                                                                                                                                                    
» gcloud ml vision detect-document barcode.jpg | grep -i "blocktype"
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",
            "blockType": "TEXT",

I also tried with this one

~/Pictures                                                                                                                                                                                                                                                                
»gcloud ml vision detect-text barcode.png                      
{
  "responses": [
    {}
  ]
}

~/Pictures                                                                                                                                                                                                                                                                    
» gcloud ml vision detect-document barcode.png
{
  "responses": [
    {}
  ]
}

1 Answers1

0

This would be easier if you showed us what code you have tried and what response you were getting from your code (and the images you were using).

In order to get a blockType barcode returned, first make sure you are using textAnnotation. The returned response should contain a textAnnotation which can be broken down to pages. From the Page, you can get blocks. If there's a barcode in the image that you are trying to annotate, you should get a barcode blockType returned.

Test with your images and see if you can get a barcode blockType returned.

EDIT:

After seeing your code (which is basically the Cloud SDK), it's clearly an issue that should be reported. Please use our Public Issue Tracker to track the issue. Alternatively, you can also report the issue with the API devs in Github issues.

Ying Li
  • 2,500
  • 2
  • 13
  • 37
  • Thank you, I have updated the question with example images and responses. – Christophe Riolo Mar 28 '18 at 05:20
  • Thanks. You are using code directly from the SDK so there shouldn't be any issue. The Cloud SDK uses the same Vision API so I fully assume it should be able to detect the barcode. I updated my answer to include next steps. – Ying Li Mar 28 '18 at 16:45