PDF417: increase the ability of the HybridBinarizer to find guard patterns?

506 views
Skip to first unread message

hfneubauer

unread,
Nov 27, 2012, 11:23:42 AM11/27/12
to zx...@googlegroups.com
Hi all,

some of you will remember that I some time ago contributed a C++ package for zxing to improve the PDF417 recognition. (And I still would like to recommend to translate it into Java in order to improve Zxing/PDF417 too; Brett; did you have a first look upon it?)

One of the approaches I contributed was another binarizer, the Delta2Binarizer, in order to offer a better grid sampler for the code patterns specially for images with poor resolution and with too narrow vertical bars. However, I do not apply this Delta2Binarizer for the whole image because the recognition would become too slow. In order to find the vertices, I still use the HybridBinarizer (however, I also changed the vertice finding algorithm).

Sometimes, I think that perhaps it should be possible to improve the HybridBinarizer, too. I have added two files, IMG0012.JPG (the original greyscale image of a PDF417 file) and HYB0012.bmp (the bit matrix result of the HybridBinarizer of that image). My question: Is it possible to improve the HybridBinarizer so that at least the guard patterns at the left and the right of the image and specially the narrow lines of these patterns would be recognized?

(Because of my vertice-finding algorithm, it is not necessary to extend the guard patterns to the very top and bottom of the code; however, it is sufficient to find two guard patterns at the left and two at the right with a significant distance between these patterns.)

Regards, hfneubauer
IMG0012.JPG
HYB0012.bmp

Brett Nieland

unread,
Nov 28, 2012, 11:25:40 AM11/28/12
to zx...@googlegroups.com
I have not been able to work back-porting to java, and, given my work load, I doubt I will be able to do so soon.  I think I will be back on the PDF417 reading part of my project 2013Q1 and hope to work on it then!

hfneubauer

unread,
Nov 29, 2012, 9:26:27 AM11/29/12
to zx...@googlegroups.com
Hi Brett,

this sounds good news! So we'll go forward with PDF417 recognition in the next few months.
However, the HybridBinarizer issue is independent from that. It is only that I see, for example, three narrow vertical lines in the greyscale image at the right side, but only two in the binarized image. And four lines at the left side (upper part) of the greyscale image, but only three in the bit matrix. (The lines at the lower part of the left side are really indistinct, so it's okay the binarizer will not recognize them). - Only if someone has the chance to show me where to adjust the HybridBinarizer source (Java or c++) in the case that only slight changes would be necessary; however, if it is too difficult, it's okay. Thanks, hfneubauer

hfneubauer-home

unread,
Nov 29, 2012, 5:05:11 PM11/29/12
to zx...@googlegroups.com
OK, perhaps there's another idea without the HybridBinarizer ... to use the Delta2Binarizer for guard-pattern finding purposes only for a couple of lines. Of course not for all lines, because this would last too much time.
Thank you for the attention.

Brett Nieland

unread,
Nov 29, 2012, 5:42:27 PM11/29/12
to hfneubauer-home, zx...@googlegroups.com
Hfneubauer,

I am sorry that I have very little to comment about your ideas.  I am afraid I am very new to coding pattern recognition.  My hope is that I will learn much if/when I get around to doing the back port. 

Regards,

Brett

--
 
 
 



--
Brett Nieland

http://www.taskstat.com
skype: 917.725.3170
cell:  646.729.4373

hfneubauer

unread,
Dec 3, 2012, 8:19:33 AM12/3/12
to zx...@googlegroups.com, hfneubauer-home
Hi all,
so I added a new update to my PDF417 commits. The changes are in:

- common/Delta2Binarizer: method "ResetMatrix" added (sets "matrix_" to null)

- pdf417/Detector/Detector: Most changes are in detect(DecodeHints const &hints). In case of "try harder", it uses a Delta2Binarizer-created bit matrix to find guard patterns. Because the Delta2Binarizer "lines matrix" is built of only every 16th line of the image, inside of "findVertices" every line of the matrix is scanned (in case of not "try harder", the original HybridBinarizer is used, and in this case every 8th line is scanned.) In any case, the original HybridBinarizer-created bit matrix is used for finding top and bottom points of the wide guard pattern bars (see "correctVertices"). The "RepositionVertices" method only recalculates the points from the Delta2Binarizer to the HybridBinarizer co-ordinates; these are only scalar operations. As in earlier version, the final vertices are calculated as the intersection points of (a)the lines which connect the inner guard pattern points and (b)the lines which connect the top resp. bottom wide guard pattern bar limits.
This might sound a little bit complicated, but these changes are effective. PDF417 codes can be recognized also under poor conditions.

-pdf417/Decoder/DecodedBitStreamPD: I have adopted the modifications recommended in the discussion of the Issue 1133 (http://code.google.com/p/zxing/issues/detail?id=1133). Is this right?

Regards, hfneubauer


Am Donnerstag, 29. November 2012 23:42:27 UTC+1 schrieb Brett Nieland:
Hfneubauer,

I am sorry that I have very little to comment about your ideas.  I am afraid I am very new to coding pattern recognition.  My hope is that I will learn much if/when I get around to doing the back port. 

Regards,

Brett
zxing-update-hfn-pdf417-20121203.zip
Reply all
Reply to author
Forward
0 new messages