hi guys, i was trying some bad images, but... i can print the image in a laser printer and read by a laser scaneer... so... i think that we could implement some image filters befor processing images...
the imagemagick have many good filters... some are here:
'auto levels', also know as image/histogram normalization
min value of gray scale, and max value are expanded to 0 and 255, for example
a min value of 200 and a max value of 235 (a very bright picture, near invisible) is changed to=>
new gray pixel value= (pixel value - 200) / (235-200) * 255
this make some bad images be readable (there´s some betters nomalizator like adaptives one that make a very very good job
another (single) idea is run this normalization on a part of image, for example 5 lines, intead get min/max of full image, get min/max of only next 5 lines and apply the normalization on these lines
http://en.wikipedia.org/wiki/Normalization_\(image_processing)
another filters...
contrast normalization (well i didn´t tested yet but, any normalization is a good filter for black/white bar codes)
check here some imagemagick filters:
http://www.imagemagick.org/script/command-line-options.php?ImageMagick=5mp5ur4cl2kc8v0mqi7tn9j2i0#auto-level
find 'normaliza' text in this page
others ideas are convolution kernels and others image processing algorithms, but normalization is a good feature and easy to implement with good results
there´s some blur/sharpen effects too
and the most important when using zebra printers (s4m or other zebra printer) i must convert some images... the problem is... a label developer design using corel draw and many colors... in zebra we only have black/white, when i have corel i can covert direct to black/white image, but when i´m in inkscape (free version that can open corel files) i convert it to grey scale png... with a macromedia fireworks or gimp or other image processor/editor, i can export it to gif black/white format, using a dither filter...
well dither is found in imagemagick, and many dither kernels/filters are explained in wiki here:
http://en.wikipedia.org/wiki/Dither
it´s like a solution to reducing bit resolution of a audio file, or in image processing reduce the image bits per pixel
i don´t know if dither is being used in zbar but my tests say that when using a barcode with 3 gray scale values it can read without problem, so in other words maybe zbar have a grayscale to black/white filter... (that´s the dither)
well i don´t know if i can help with others ideas to make zbar better and better, i will try to get some bad images that can be printed and read by a laser scaner to make some solutions to be implemented in zbar, ok?
here is some examples of normalization (check the gray scale examples to check what´s the results)
http://www.ipol.im/pub/algo/lmps_simplest_color_balance/
the per group of lines idea is very good for this problem, since the line that we will scan is the only important part of image, and not the full image, so normalizing the group of rows that we will scan is better than normalizing the full image
well i have many ideas and one php script doing this before using zbarimg, this is working but i don´t like the idea of a php script and a zbar program, i would like a zbar only solution =) that´s very nice to zbar code :)
i tested some images that i get bad recognition....
my webcam image is 320x240 16bits color
what i did to run it nice...
a motion blur (90 degree since my barcode is on horizontal and bars are vertical, but could use near 70 to 110 degree, 10pixels of motion)
convert to grayscale
a color normalization (to expand min max to 0 - 255)
convert to black white with a diter of 25% (Floyd-Steinberg)
the motion blur is explained here:http://en.wikipedia.org/wiki/Motion_blur
for 1D barcodes i think it´s a very very good noise reduction filter if you know what angle your barcode is comming
the normalization is explained before at http://www.ipol.im/pub/algo/lmps_simplest_color_balance/
and
http://en.wikipedia.org/wiki/Normalization_\(image_processing)
the ditter i just pointed but i´m using a specific ditter algorithm at here:
http://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering
well i think that´s all we need to implement as filters... maybe a sharpen is usefull too but a contrast change is better (in my tests), sharpen only runs well if image don´t have many greyscale noise
well.. here is sharpen (didn´t foudn algorithm yet, but it´s implemented in imagemagick):
http://en.wikipedia.org/wiki/Unsharp_mask
and here is contrast change (didn´t found algorithm, but have in imagemagick too)
http://en.wikipedia.org/wiki/Contrast_\(vision)
since i´m giving many filters, i don´t know if a zbar filter could be implemented (it´s a lot of parameters and filter order change things a lot)
well check if it´s usefull, i think yes, but don´t know how to easly implement in zbar...
i´m thinking now... i just tested in images... in a camera, this could be done faster... maybe a command line for each image isn´t hte right solution, maybe a zbarcam with some parameters still the better solution... any idea?