ZXing using Webcam in C#

1,615 views
Skip to first unread message

rohit

unread,
Jul 3, 2010, 7:51:35 AM7/3/10
to zxing
For one of my college project in C#, i am trying to decode Zxing from
webcam. For this i am using C# version from svn. It works perfectly
when i use Zxing image directly from my pc. But when i try to decode
Zxing image from webcam frame, it fails to decode. Could you guys
please help me to solve this issue. It's really urget to finish my
project. Thanks

Bas Vijfwinkel

unread,
Jul 5, 2010, 3:04:56 AM7/5/10
to zxing
I encountered the same problem when developping the Actionscript/Flash
application.

Check if you set the webcam to a decent resolution (eg.1024x768)
because sometimes the default resolution is set to 150x90.
Just using the default settings won't work. =)
The further away you want to scan the barcode, the higher the
resolution has to be.

Also try to make a preview window in your application. This really
helps a lot.
This will show you directly if your camera might be out of focus or
another optical problem is causing the problem.
Some webcams have poor white balance correction build in, causing the
barcode to become almost white.
It's not related to cheap webcams, even the 'better' brands have this
problem.

If that also does not work, take a snapshot image with your
application and save it as an image.
Then try the online decoder. If the online decoder does work, then
there might be something wrong with your settings.
Maybe excluded some barcode types or not set the 'TRY HARDER' setting?

Good luck.

Bas Vijfwinkel

Angus

unread,
Jul 15, 2010, 12:03:09 PM7/15/10
to zxing
I tried Bas Vijfwinkel's actionScript client with my very old fuzzy
webcam, and couldnt decode any PDF417's
even after I did some image processing on the original ( full
contrast, greyscale )

I also tried this online reader...

http://www.datasymbol.com/barcode-recognition-sdk/barcode-reader/online-barcode-decoder.html

which could decode all my test snapshots - even the fuzzy original

any advice ?

Angus

Sean Owen

unread,
Jul 15, 2010, 12:07:08 PM7/15/10
to zxing
One big difference is that the PDF417 decoder here doesn't have error
correction. Without that it won't work well. It also uses a simplistic
detection algorithm. I'd think of it as 'alpha' and basically
unsupported since it is not realistic to read these on camera phones.

On Jul 15, 5:03 pm, Angus <angvz...@gmail.com> wrote:
> I tried Bas Vijfwinkel's actionScript client with my very old fuzzy
> webcam, and couldnt decode any PDF417's
> even after I did some image processing on the original ( full
> contrast, greyscale )
>
> I also tried this online reader...
>
> http://www.datasymbol.com/barcode-recognition-sdk/barcode-reader/onli...

Angus

unread,
Jul 15, 2010, 12:27:03 PM7/15/10
to zxing
i see that now - i did some tests and even a 5deg rotate or a 5% blur
caused it to fail.
and that SDK i tested online costs $$$$....

Angus

unread,
Jul 15, 2010, 1:37:37 PM7/15/10
to zxing
I found libdmtx

"libdmtx is open source software for reading and writing Data Matrix
2D barcodes"

i wonder if i can use this as a bolt on pre-processor for zxing ?

Sean Owen

unread,
Jul 15, 2010, 2:15:06 PM7/15/10
to zxing
Data Matrix != PDF417, so not sure what you mean.
It is GPLed, so we can't use it but you can.

Bas Vijfwinkel

unread,
Jul 16, 2010, 5:17:25 AM7/16/10
to zxing
The default resolution of the actionscript client has been set to
350x350, which should be sufficient for most 1D barcodes and small QR
codes.
That is definitely not enough for PDF417 unless you have a really good
webcam.
Have you tried to increase the resolution ?

Have you also tried to feed the snapshots to the zxing online library?
If it can decode the barcodes and the actionscript client doesn't,
then it must be something in the client.
I only tested the examples present in the repository because I
couldn't find any other (besides computer generated ones).

>i see that now - i did some tests and even a 5deg rotate or a 5% blur
>caused it to fail.
I don't see why rotating/blurring would increase the recognition?

Could you post the images so we can have a look at them?

Reply all
Reply to author
Forward
0 new messages