The aim for this little project was to detect a pre-defined barcode object, from an arbitrary image, in an unknown lighting condition.

The input image sequence was taken from an iPhone attached to a mobile robot.

The main work is done by the Haar feature detector. Many positive (containing barcode), and negative samples are fed into the trainer. Then the trainer extracts Haar-like features, and uses them to form the training data.

The training data is then used in real-time to decide whether the features extracted from the current image represent a barcode or not.

The detected barcodes are then passed to the tracking sub-system to:

  • assign a unique ID to each barcode
  • calculate a confidence value for each tracked barcode, and remove less confident barcodes,
  • filter noises, track positions, calculate an estimated position when losing a barcode in a short period
  • estimating a velocity for each barcode

After creating the list of current barcodes, the value detection sub-system tries to determine the value of each barcode. The value is defined as the height of the barcode’s black area.

The value detection procedure is as follows:

  1. Determining the 3D transformation of the barcode, relative to the camera.
  2. Detecting the black rectangle inside the barcode, and calculating its height
  3. Applying some filters to the detected value. I’ve used a median filter of size 5 and the results were just fine.

Leave a comment