GNOME Bugzilla – Bug 630830
zbar: Fixes, single frame scan and width/stride fix
Last modified: 2010-11-02 17:49:37 UTC
Created attachment 171275 [details] [review] make scanner cache optional Make scanner cache optional, otherwise a single frame (think png image) won't get scanned for some reason. Also fix width/stride of frame different width work properly.
Created attachment 171276 [details] [review] Fix width
Comment on attachment 171275 [details] [review] make scanner cache optional Thanks for the patch. I committed thsi with a minor correction.
Comment on attachment 171276 [details] [review] Fix width I could not see any need for this in the zbar API - http://zbar.sourceforge.net/api/index.html Anymore details?
(In reply to comment #3) > (From update of attachment 171276 [details] [review]) > I could not see any need for this in the zbar API - > http://zbar.sourceforge.net/api/index.html > > Anymore details? The caps contain the width in pixels, but zbar needs the stride in bytes to process the image correctly (for 'odd' widths), otherwise it will process the image in a way that makes it appear as if each line is slightly shifted to the left compared to the previous line. For bonus points use: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#gst-video-format-get-row-stride
Comment #4 explains it. I found this as I had a hard time trying to scan some still images until I noticed it depended on the image width instead of something wrong with the barcode itself in the image.
Created attachment 172442 [details] [review] pass the rowstride to zbar Tim, like this? Is it okay to take the stride for Y?
Looks good to me, but haven't tested it. Maybe one should add a zbar->stride member to make things clearer in the code (in addition to zbar->width, or in place of, don't know if width is needed anywhere).
I don't know if its needed either. It works fine for me as it is.
> I don't know if its needed either. It works fine for me as it is. If you try the test image that comes with zbar (http://zbar.sf.net/test/barcode.png) you'll find that without the stride fix the quality score is 21 and with the stride fix it's 103 (I'm assuming higher numbers are better). I've committed this now: commit 7ddd7f7809dafde556c7f9a16e53542722564d1c Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Nov 2 17:18:52 2010 +0000 zbar: use correct stride Fixes detection for images with a width that's not a multiple of four. Based on patch by: Kaj-Michael Lang <milang@tal.org> Based on patch by: Stefan Kost <ensonic@users.sf.net> https://bugzilla.gnome.org/show_bug.cgi?id=630830 and also this: commit 2122c1eb9ad6df534ead1930daff9a17a0817ee8 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Nov 2 16:32:55 2010 +0000 zbar: disable cache by default Since it breaks still image bar code detection. Thanks for the patches!