Depends on the quality of the scans. If you have low-res scans with lots of artefacts and other graphic or text around the bar code and the bar code tilted, then you have a major project on your hand. If possible find a free bar code scan utility. Also there lots of different bar code standards, if you need to parse more than one it gets really difficult
If you have non of the above problems, you might do something like this (this is theoretical, never done this in practice):
1) Store lets say 20 or 40 horizontal lines from the vertical middle of the image bitmap to an array of arrays
2) Find out the blackest and the whitest value from a block in the horizontal middle of these lines and subtract some error margin to get the thresholds or simple take the mean value as transition value
3) Calculate for each of these lines black-to-white and white-to-black transitions based on the thresholds or the transition value
4) Average those transitions that occur in more than 80% of the lines at the same horizontal place plus minus an error value
5) Collect all the widths of black lines (difference of the white-to-black to the next black-to-white transition). You should get values the raster of the bar code out of this after some averaging.
6) Take the first white-to-black transition as starting point. If you find the start code, good. If it doesn't work out, take the next white-to-black transition,...
In reply to Re: Barcode Recognition
by jethro
in thread Barcode Recognition
by avo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |