OZONE Asylum
Forums
OZONE
Barcode/Datamatrix/Image Vectorization
This page's ID:
28465
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Ok, proposal. 1) scanline detect the 4 extremums of your barcode surface. scanline detect means: parse every line, memorizing only the distance of the first pixel you encouter from the left and right borders. You can parse each line from left until the first black point appears, then skip to the right, do the same from the right of the line, and store these offsets in a table (the table can be of dimension: [2][pixel height of image], which maps to [x offset][y offset] implicitely). max complexity is O(w*h). Generally, closer to half or less of that. This is what is done in a graphic card pipeline to prepare offsets for textures, and in most 3d engines. [img]http://www.beyondwonderland.com/data/images/barcode1.gif[/img] 2) Now your image is a texture (the barcode perfectly fits a polygon), and due to it's square nature in real world, you can easilly unskew it. How? [img]http://www.beyondwonderland.com/data/images/barcode2.gif[/img] By handling "floating point" pixels. Given the canvas of your target, unskewed barcode image. It's w/h, we'll name "main_w" and "main_h". Given the four points we have extracted before, A, B, C, D (in clockwise order) All you have to do now is plot "main_w * main_h" pixels, and color them the same way as each row of the ABCD polygon. To do this: 1) divide AD in main_h points. The same for BC. 2) parse your array of AnDn -> BnCn skewed lines, each time dividing the length of the line in main_w steps. Max complexity is, again, O(w*h). Since the algorithm proposed above is composed of two sequences of identical theorical complexity, O(width*height), it's total theorical complexity is O(width"height) (not 2O(width*height)). Aka one single image pass. You can then use the middle line I represented above and the same notion of proportions to accurately read your barcode. [small](Edited by [url=http://www.ozoneasylum.com/user/5827]_Mauro[/url] on 09-23-2006 17:08)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »