scan

FREEMIUM
By Yury2 | Updated לפני חודשיים | Data
Health Check

N/A

Back to All Tutorials (1)

API Tutorial: Barcode detection and scanning

Barcodes and what are they good for

Barcode is a powerful tool that can transform data, a string or a binary for instance, into image data fast and deterministically (meaning there’s only one image for one particular set of data).
There are many use cases for that technology, as it is evident by the amount of different types of barcodes, but unfortunately barcode reading equipment is pricey which puts a high entry threshold.
However, modern OCR solutions can easily turn this situation around. This simple and fast API can do exactly that.

Barcode scan use cases

  1. Shipping and receiving: logistics industry could use a way to read markings on shipped products to automatically collect data on how the supply moves and where it is located at the moment.
  2. Proof of delivery: even the customers could use a simple way to mark an order completion when their goods arrive with a convenient barcode on their package.
  3. Asset management: in order to track material equipment it could easily be marked with barcodes which then could be conveniently read with scanner.
  4. Gift-cards: issuing a gift card with a barcode to track its data like remaining balance and expiration date could easily optimize this business process.
  5. Augmented reality applications: users could easily access more data from their surrounding just through their smartphone screen, scanning different entities into their shopping carts or links to learn more in a museum or a zoo.

How does this API help?

This API simply detects all the barcodes on a given picture. User can supply a list of barcode types to search for, and can provide an image via link, base64-encoded image string or a direct binary upload via form-data, in that order of priority.

POST /scan

Calling barcode scan API results in a JSON response.

  "time": 0.772,
  "result": [
    {
      "value": "t=20200915T2019&s=177.38&fn=9280440300268736&i=56223&fp=2542966661&n=1",
      "valuebase64": "dD0yMDIwMDkxNVQyMDE5JnM9MTc3LjM4JmZuPTkyODA0NDAzMDAyNjg3MzYmaT01NjIyMyZmcD0yNTQyOTY2NjYxJm49MQ==",
      "type": "QR-CODE"
    }
  ],
  "code": 200

The “time” key represents how much time it took for the recognizer to produce the result. It has a timeout of about 11 seconds to decode the data from one picture.

Scanning results are located under the “result” key.

Scanner always delivers base64 representation of the data, in case there was a binary data encoded in the barcode. In that case “value” will be empty, but developer will be able to decode and use the data either way.