Wiki source for Blog20110603BarCodeWebcam
My use case would be to show my book's barcode in front of the webcam and provide automatically the ISBN (EAN) to gcstar and launch search. This would permit to enter my library a bit faster ;-)
===Some tools that recognize barcode using a webcam===
http://sdlcam.raphnet.net/
http://jlinbar.sourceforge.net/ java, no doc to launch it o_O (check wiki though)
http://forums.gcstar.org/viewtopic.php?id=263
http://wiki.gcstar.org/en/barcodescanner
http://svn.gna.org/viewcvs/gcstar/scanner/ source code + apk file
http://graphics.tudelft.nl/~jorik/css/barcode.html good spirit :-) and using ffmpeg
The option pgmpipe was not working as not implemented in default ffmpeg on Mageia 1, see
http://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia/distrib/1/i586/media/tainted/release/
hmmm pgmpipe not by default either :/
http://sourceforge.net/projects/zbar/ (new name for zebra) qt4 & gtk UI available apparently
===Using gcstar===
See CompileGcstar
http://wiki.gcstar.org/en/barcodescanner
http://forums.gcstar.org/viewtopic.php?pid=7499#p7499
I'd like to use:
~- amazon.fr or amazon.uk or amazon.com on computer's side with gcstar >= 1.6.2
~- EAN-13 instead of ISBN-10 (EAN-13 is scanned by default by QRdroid private): well this seems a problem with the add-on I chose to find the book, as with netcat I can see that the EAN-13 is correctly provided by gcstar scanner
%%nc -vv -l -p 50007
listening on [any] 50007 ...
192.168.3.1: inverse host lookup failed: Unknown host
connect to [192.168.3.52] from (UNKNOWN) [192.168.3.1] 43588
<scans><scan format='EAN_13'>3780193006955</scan></scans>
<scans><scan format='EAN_13'>9782290307274</scan></scans>
<scans><scan format='EAN_13'>9782070403974</scan></scans>
^C sent 0, rcvd 174%%
http://forums.gcstar.org/viewtopic.php?pid=7363 in python on android
http://forums.gcstar.org/viewtopic.php?id=1632
===Using JLinBar===
Check http://ubuntuforums.org/archive/index.php/t-1375793.html
http://code.google.com/p/v4l4j/downloads/list
tar xvf v4l4j-0.8.10.tar.gz
cd v4l4j-0.8.10
export JDK_HOME=/usr/lib/jvm/java-1.6.0-openjdk
ant all
sudo ant install
ant test-gui
ant deviceInfo
http://code.google.com/p/zxing/wiki/GettingStarted
cd ../zxing/
ant -f core/build.xml
ant -f javase/build.xml
%%java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner ../UPC_A.png
file:/home/baud/Development/scanner_codebarre/zxing/../UPC_A.png (format: UPC_A, type: PRODUCT):
Raw result:
987654321098
Parsed result:
987654321098
Found 2 result points.
Point 0: (51.5,240.0)
Point 1: (623.5,240.0)
%%
http://jlinbar.svn.sourceforge.net/viewvc/jlinbar/trunk/0.03-release/README?revision=13&view=markup
%%java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/v4l4j.jar -jar jlinbar.jar
Exception in thread "main" java.lang.NoClassDefFoundError: au/edu/jcu/v4l4j/FrameGrabber
Caused by: java.lang.ClassNotFoundException: au.edu.jcu.v4l4j.FrameGrabber
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: net.planewalk.apollon.jlinbar.JLinBar. Program will exit.
%%
===Using vgrabbj and gocr for barcode decoding===
http://forums.gcstar.org/viewtopic.php?pid=2264 and http://forum.framasoft.org/viewtopic.php?t=28412
%%$ vgrabbj -d /dev/video -o ppm | gocr -%%
what worked for me : %%$ vgrabbj -d /dev/video0 -o ppm | gocr -%%
well, disappointingly I keep having %%<barcode type="unknown" /><barcode type="unknown" />%%
vgrabbj -d /dev/video2 -i vga -o ppm -f essaivga2.ppm -l 1 # will launch vgrabbj as a deamon and take an image every second, re-writing the file
display # will show the image (have to tweak to be displayed whenever it changes, or perhaps does it automatically)
you can use the option sxga for 1280x1024 instead of vga
===Other ocr tools to try===
http://people.inf.ethz.ch/adelmanr/batoo/index.php/Documentation/Installation batoo ocr tool (J2ME available)
http://old.nabble.com/-Tellico-users--Webcam-barcode-scanning-td26100228.html recompile tellico with ""--enable-webcam""
===The webcam(s) used===
Integrated webcam in Latitude E6400 (does not work that well... blurred)
Logitech Pro 4000 640x480 perhaps missing auto-focus
Eee PC 901 1,3 Mpixel maybe 1280x1024 ? according to [[http://web.forret.com/tools/megapixel.asp?title=1.3+Megapixel+camera&width=1280&height=1024]]
Those integrated webcams seem to lack auto-focus support, in the end only scanning with my smartphone HTC Desire Z seemed to work effectively.
===Verifying that gocr works on barcode===
Well, to check that gocr works, just use {{image class="right" alt="barcode" title="a barcode" width="333" height="240" url="http://upload.wikimedia.org/wikipedia/commons/f/fe/UPC_A.svg" link="http://upload.wikimedia.org/wikipedia/commons/f/fe/UPC_A.svg"}}
~- convert it with inkscape to png (convert tool does not seem to work perfectly with svg yet ?)
~- then gocr -i UPC_A.png # provides %%
_<barcode type="UPC" chars="13" code="0987654321098" crc="0" error="0.012" />
9 87654 32109 8%%
===Some tools that recognize barcode using a webcam===
http://sdlcam.raphnet.net/
http://jlinbar.sourceforge.net/ java, no doc to launch it o_O (check wiki though)
http://forums.gcstar.org/viewtopic.php?id=263
http://wiki.gcstar.org/en/barcodescanner
http://svn.gna.org/viewcvs/gcstar/scanner/ source code + apk file
http://graphics.tudelft.nl/~jorik/css/barcode.html good spirit :-) and using ffmpeg
The option pgmpipe was not working as not implemented in default ffmpeg on Mageia 1, see
http://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia/distrib/1/i586/media/tainted/release/
hmmm pgmpipe not by default either :/
http://sourceforge.net/projects/zbar/ (new name for zebra) qt4 & gtk UI available apparently
===Using gcstar===
See CompileGcstar
http://wiki.gcstar.org/en/barcodescanner
http://forums.gcstar.org/viewtopic.php?pid=7499#p7499
I'd like to use:
~- amazon.fr or amazon.uk or amazon.com on computer's side with gcstar >= 1.6.2
~- EAN-13 instead of ISBN-10 (EAN-13 is scanned by default by QRdroid private): well this seems a problem with the add-on I chose to find the book, as with netcat I can see that the EAN-13 is correctly provided by gcstar scanner
%%nc -vv -l -p 50007
listening on [any] 50007 ...
192.168.3.1: inverse host lookup failed: Unknown host
connect to [192.168.3.52] from (UNKNOWN) [192.168.3.1] 43588
<scans><scan format='EAN_13'>3780193006955</scan></scans>
<scans><scan format='EAN_13'>9782290307274</scan></scans>
<scans><scan format='EAN_13'>9782070403974</scan></scans>
^C sent 0, rcvd 174%%
http://forums.gcstar.org/viewtopic.php?pid=7363 in python on android
http://forums.gcstar.org/viewtopic.php?id=1632
===Using JLinBar===
Check http://ubuntuforums.org/archive/index.php/t-1375793.html
http://code.google.com/p/v4l4j/downloads/list
tar xvf v4l4j-0.8.10.tar.gz
cd v4l4j-0.8.10
export JDK_HOME=/usr/lib/jvm/java-1.6.0-openjdk
ant all
sudo ant install
ant test-gui
ant deviceInfo
http://code.google.com/p/zxing/wiki/GettingStarted
cd ../zxing/
ant -f core/build.xml
ant -f javase/build.xml
%%java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner ../UPC_A.png
file:/home/baud/Development/scanner_codebarre/zxing/../UPC_A.png (format: UPC_A, type: PRODUCT):
Raw result:
987654321098
Parsed result:
987654321098
Found 2 result points.
Point 0: (51.5,240.0)
Point 1: (623.5,240.0)
%%
http://jlinbar.svn.sourceforge.net/viewvc/jlinbar/trunk/0.03-release/README?revision=13&view=markup
%%java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/v4l4j.jar -jar jlinbar.jar
Exception in thread "main" java.lang.NoClassDefFoundError: au/edu/jcu/v4l4j/FrameGrabber
Caused by: java.lang.ClassNotFoundException: au.edu.jcu.v4l4j.FrameGrabber
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: net.planewalk.apollon.jlinbar.JLinBar. Program will exit.
%%
===Using vgrabbj and gocr for barcode decoding===
http://forums.gcstar.org/viewtopic.php?pid=2264 and http://forum.framasoft.org/viewtopic.php?t=28412
%%$ vgrabbj -d /dev/video -o ppm | gocr -%%
what worked for me : %%$ vgrabbj -d /dev/video0 -o ppm | gocr -%%
well, disappointingly I keep having %%<barcode type="unknown" /><barcode type="unknown" />%%
vgrabbj -d /dev/video2 -i vga -o ppm -f essaivga2.ppm -l 1 # will launch vgrabbj as a deamon and take an image every second, re-writing the file
display # will show the image (have to tweak to be displayed whenever it changes, or perhaps does it automatically)
you can use the option sxga for 1280x1024 instead of vga
===Other ocr tools to try===
http://people.inf.ethz.ch/adelmanr/batoo/index.php/Documentation/Installation batoo ocr tool (J2ME available)
http://old.nabble.com/-Tellico-users--Webcam-barcode-scanning-td26100228.html recompile tellico with ""--enable-webcam""
===The webcam(s) used===
Integrated webcam in Latitude E6400 (does not work that well... blurred)
Logitech Pro 4000 640x480 perhaps missing auto-focus
Eee PC 901 1,3 Mpixel maybe 1280x1024 ? according to [[http://web.forret.com/tools/megapixel.asp?title=1.3+Megapixel+camera&width=1280&height=1024]]
Those integrated webcams seem to lack auto-focus support, in the end only scanning with my smartphone HTC Desire Z seemed to work effectively.
===Verifying that gocr works on barcode===
Well, to check that gocr works, just use {{image class="right" alt="barcode" title="a barcode" width="333" height="240" url="http://upload.wikimedia.org/wikipedia/commons/f/fe/UPC_A.svg" link="http://upload.wikimedia.org/wikipedia/commons/f/fe/UPC_A.svg"}}
~- convert it with inkscape to png (convert tool does not seem to work perfectly with svg yet ?)
~- then gocr -i UPC_A.png # provides %%
_<barcode type="UPC" chars="13" code="0987654321098" crc="0" error="0.012" />
9 87654 32109 8%%