After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630830 - zbar: Fixes, single frame scan and width/stride fix
zbar: Fixes, single frame scan and width/stride fix
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.20
Other Linux
: Normal enhancement
: 0.10.21
Assigned To: Tim-Philipp Müller
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-28 16:18 UTC by Kaj-Michael Lang
Modified: 2010-11-02 17:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
make scanner cache optional (3.84 KB, patch)
2010-09-28 16:18 UTC, Kaj-Michael Lang
committed Details | Review
Fix width (743 bytes, patch)
2010-09-28 16:19 UTC, Kaj-Michael Lang
none Details | Review
pass the rowstride to zbar (1.34 KB, patch)
2010-10-15 17:51 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Kaj-Michael Lang 2010-09-28 16:18:57 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.
Comment 1 Kaj-Michael Lang 2010-09-28 16:19:32 UTC
Created attachment 171276 [details] [review]
Fix width
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2010-10-14 20:55:50 UTC
Comment on attachment 171275 [details] [review]
make scanner cache optional

Thanks for the patch. I committed thsi with a minor correction.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2010-10-14 20:56:46 UTC
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?
Comment 4 Tim-Philipp Müller 2010-10-14 23:19:36 UTC
(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 5 Kaj-Michael Lang 2010-10-15 11:03:39 UTC
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.
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2010-10-15 17:51:16 UTC
Created attachment 172442 [details] [review]
pass the rowstride to zbar

Tim, like this? Is it okay to take the stride for Y?
Comment 7 Tim-Philipp Müller 2010-10-15 18:03:22 UTC
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).
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2010-11-01 20:43:47 UTC
I don't know if its needed either. It works fine for me as it is.
Comment 9 Tim-Philipp Müller 2010-11-02 17:49:37 UTC
> 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!