0

A scanned image contains 96 barcodes. There is an example below.

To read barcodes I use library from inliteresearch.com .

If one or more barcodes are missing in image (i.e it contains less than 96 barcodes, in other words, there is a blank space instead of a barcode), how can I read barcodes continuously and return null if a barcode does not exist in image?

Example: barcode 65 is missing. Return all barcodes values from 1 to 64 then null for 65 then values from 66 to 96.

image Example

  • 1
    if the size of each bar code is always the same, you can split your main image into a grid and then process cells one by one. – jhamon Mar 17 '16 at 08:34
  • 1
    Does this library report the locations of the codes ? –  Mar 17 '16 at 10:17
  • i can't get code width and height, but i can get left, right, top,bottom coordinates –  Mar 17 '16 at 10:34
  • @SamvelMalintsyan so you get width and height and position. where is your problem then? – Piglet Mar 17 '16 at 12:11

2 Answers2

1

Horizontal and vertical projections of the image (sum of pixel values along rows or columns) clearly tell you where the rows of codes are found.

enter image description here

Then is is a simple matter to find the ROIs containing individual codes.


If you have the coordinates of the centers of the codes, you can group them in columns as follows: sort by increasing X, and compute the deltas. Then sort the deltas by decreasing values. The largest deltas tell you where to split with vertical lines and give you an estimate of the pitch.

0

If position and size of DMCs is known use ROIS (evaluate sub-images at fixed positions). Then put the result of your DMC reader into an array.

To find DMCs of unknown arrangement/position you can count blobs after dilation (either dilate a binary image or apply a maximum filter to the gray image) Sort the detected blob coordinates by their position or whatever order you want. Then use the gathered positions to get the respective subimages for DMC reading.

Proper DMC reading libraries provide reading multiple codes at once and the DMC position after reading. If yours does, you can just sort your DMCs by position and check for any gaps.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • Can you send link for download DMC library ? –  Mar 17 '16 at 11:13
  • @SamvelMalintsyan I only work with proprietary software only sry. I guess you are looking for something for free. Haven't found a free one that suits my needs so far. doesn't your library provide code position? – Piglet Mar 17 '16 at 12:09
  • @SamvelMalintsyan you commented befor that you have corner coordinates of your DMCs, so I'm not quite sure what your problem is. – Piglet Mar 17 '16 at 12:35