GithubHelp home page GithubHelp logo

barcode_inspection_api's Introduction

Barcode Analysis API for Smart Manufacturing

Barcode analysis is a crucial factor to consider in product packaging. Barcodes are present on most products, and it is essential to ensure that they are both accurate and readable. However, manually verifying the barcodes of numerous products is a time-consuming and costly task that is prone to errors. To overcome this challenge, computer vision systems can quickly and accurately verify barcodes, identifying any products with faulty codes and redirecting them accordingly. In this practice, we will demonstrate how to generate a barcode, extract its type and data and then wrap up its data extraction system into an API for further utilization.

Project Walkthrough

  • Generate EAN13 barcode as png file using barcode python library.
  • Extract barcode data and type using pyzbar python library.
  • Build an API based on flask for barcode data and type extraction.

Dependencies

Barcode
UUID
OPenCV
Numpy
Pyzbar
Requests
Json
Jsonpickle
Flask

Dataset

For testing our system, we have used images from the internet, in particular manufactured products images such as bottles, snacks, boxes, cans...

testing_images

Barcodes Generation

barcode is a python library used to create different standard types of barcodes. The library can generate SVG objects as well as PNG images. Python-barcode can generate the following types of barcodes:

  • EAN-8
  • EAN-13
  • EAN-14
  • UPC-A
  • JAN
  • ISBN-10
  • ISBN-13
from barcode import EAN13                   # imported to create EAN13 barcodes
from barcode.writer import ImageWriter      # imported to save generated bar
import uuid                                 # imported to generate unique numbers, later used for barcode creation.

# Create Random and Unique number for our barcode
random_number = str(uuid.uuid1().int)[:14]
print(random_number)

# Create an EAN13 barcode
my_code = EAN13(random_number, writer=ImageWriter())

# Save the barcode as png image
my_code.save("barcode_1")

Barcode Reading From the Generated Barcodes

Example1 test1

Example2 test2

Test API

The API takes as input the product image containing the barcode, read it and output the result as a json response with 3 key pieces of information: barcode data, barcode type and request status.

api_test

API message codes

We have 3 messages codes:

  • 200: successful request
  • 404: no barcode data has been extracted
  • 403: wrong authentification key

error_code

Improvment

  • Try different barcode readers libraries since Pyzbar does not support all barcode types. It was unable to work on certain products like product20 from our dataset.

barcode_inspection_api's People

Contributors

wendgoundi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.