j-corvo / ip_toolbox

Image Processing Toolbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Processing Toolbox - Barcode Detector

This repository contains a toolbox for barcode detection using a custom-made optimized version of the OpenCV library. All the filters and image transformations for the barcode scanning process were implemented from scratch. The goal of this repository is to try to give an optimized version of the already implemented methods found in the OpenCV library.

image

Implementation and Methods

The methods implemented in this solution are the following and can be divided into categories:

  • Color:
    • Negative
    • Gray
    • Isolate (Red, Green, Blue)
  • Transforms:
    • Translation
    • Rotation
    • Bilinear Rotation
    • Zoom (click on a point)
    • Auto zoom
    • Bilinear Scaling
  • Filters:
    • Uniform Mean
    • Non-Uniform Mean
    • Sobel
    • Differentiation
    • Roberts
  • Visualization:
    • Histogram
    • Equalization Histogram
    • Histogram Filtering (horizontal mean, horizontal match, vertical mean, vertical match)
  • Projections:
    • Vertical
    • Horizontal
  • Morphology:
    • Dilation
    • Erosion
    • Open (1x, 5x, 10x, 20x)
    • Close (1x, 2x, 5x, 10x)
    • Vertical Line Preservation (isolate vertical lines)
    • Horizontal Line Preservation (isolates horizontal lines)
    • Otsu Binarization
    • BlackHat Transform
    • WhiteHat Transform

For barcode identification, some more methods were implemented such as:

  • Angle Finder -> Identify the rotation angle of the barcode
  • Isolate Numbers -> Segmentation of the numbers in the barcode
  • IdentifyCB -> Identify the position of the Barcode and draw a square on it

Performance

In this toolbox, some methods could be improved, decreasing the processing time compared to the OpenCV library.

SS_image

The times are depicted in the following table:

Method ip_toolbox OpenCV Time difference (secs)
Roberts 11.210 18.245 -7.035
Differentiation 11.321 16.036 -4.715
Otsu 8.002 4.000 +2.002
Binarization 3.000 6.002 -3.002
Sobel (3x3) 28.735 8.206 +20.529
Bilinear Scaling 29.651 1.096 +28.555

In conclusion, everybody knows that OpenCV is a highly optimized library with hundreds of contributors, thus, higher time results were expected from an implementation from scratch. However, it was satisfactory to see that, in some methods, the ip_toolbox had better results than OpenCV. It is always a challenge to defy the odds and try new approaches!

How to use

  1. Clone the repository to your computer.
  2. Open Visual Studio (the version doesn't matter, even though it is a project from 2019, it runs in the most recent version of VS).
  3. Open the file name SS_OpenCV_2019.sln.
  4. Run the application and a window like this will open:

image

Open a Single Image

To open a single image and apply the methods implemented follow the steps above:

  1. Go to File->Open and open an image on your computer or in the repository folder.
  2. On the top choose Image and select which transformation you would like to see in the image (negative in the picture):

image

Performance table and Image test

To access the table with the comparison between the ip_toolbox and OpenCV and run a single or all the methods implemented follow the steps described above:

  1. On the top, click on the option "Eval".
  2. Then a window will open and click on "Single Image Process" (see the picture):

image

In this moment, two options can be chosen:

  1. Select "Run All" button and all the methods will be tested and performances will show in the table.
  2. Select a method and click on the "Run Selected" button to run it for a single image.

To go through the images click on "Next" and "Previous" buttons.

Barcode Detection

To run the barcode detection, first follow the steps 1) and 2) of the section above. Then:

  1. Choose a barcode image.
  2. Select the first option named "Barcode Reader".
  3. Select "Run Selected".

The result should look like this:

image

About

Image Processing Toolbox

License:Apache License 2.0


Languages

Language:C# 100.0%