GithubHelp home page GithubHelp logo

barcode-extractor's Introduction

Barcode Extractor using OpenCV

Pipeline to extract barcode number from images using OpenCV functions. A simple k-neighbours classifier was trained to detect the numbers present in the barcode.

Image pre-processing

  • convert image to grayscale
  • create structure element for extracting vertical lines through morphology operations. (using cv2.getStructuringElement())
  • apply morphological operations. (using cv2.erode() and cv2.dilate())
  • using binary_inverse and otsu thresholding using cv2.threshold()

Digit Extraction

Extract digits present in the training set images using cv2.findContours(). Manually segregate the extracted digits to generate the training set images.

digit

HOG Feature Extractor

Feature extraction is the process of identifying the unique characteristics of an input (digit in our case) which enables in training a Machine Learning algorithm. Histogram of Oriented Gradients(HOG) are feature extractors mainly used in computer vision for object detection. The reason HOG is utilized so heavily is because local object appearance and shape can be characterized using the distribution of local intensity gradients.

The extracted features from HOG are given as input to train a k-neighbours classifier with n_neighbors=1.

Testing

  • apply the above image processing methods on test images
  • extract the digits from the processed image
  • extract features for the digits using HOG
  • predict on these features using the trained knn model.
  • concatenate the predicted digits to obtain the barcode number

References

https://towardsdatascience.com/scanned-digits-recognition-using-k-nearest-neighbor-k-nn-d1a1528f0dea https://gurus.pyimagesearch.com/lesson-sample-histogram-of-oriented-gradients-and-car-logo-recognition/ https://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python

barcode-extractor's People

Contributors

jebastin-nadar 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.