QR code (2D barcode) coding and decoding algorithm

2019-01-16 01:11发布

问题:

Looking for free/opensource code or description of algorithms to code (simple) and decode (hard) the 2D barcode QR code.

It doesn't seem like a trivial problem, but it's so popular in Japan that there must be something already available...

回答1:

I have a colleague who worked on ZXing ("Zebra Crossing").

That's got a fair variety of platform support.



回答2:

(In response to those asking about QR codes in PHP)

The Google Charts QR chart type might work for you, if you don't expect a lot of traffic, or if you can cache the images. It's extremely easy to use- just put the text to encode in the URL.



回答3:

QR Code Demystified - Part 1
QR Code Demystified - Part 2
QR Code Demystified - Part 3
QR Code Demystified - Part 4
QR Code Demystified - Part 5
QR Code Demystified - Part 6

and

http://www.thonky.com/qr-code-tutorial/introduction/

To know the Mathematics theory behind it there is a discussion in Math Stackexchange

https://math.stackexchange.com/questions/76045/reed-solomon-polynomial-generator



回答4:

Here's a good LGPL library for encoding QR code libqrencode

Libqrencode is a C library for encoding data in a QR Code symbol, a kind of 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and is highly robust.

Here's a Google code project that decodes QR code - aimed at iPhone, but is LGPL and the source is available. Should be adaptable...

-Adam



回答5:

http://www.swetake.com/qr/qr1_en.html

Just thought I'd mention this one which is explaining HOW they work.



回答6:

PyQrCodec is a Python library for encoding Qr codes to a PNG and decoding them from a variety of image formats.



回答7:

You can find c# example here http://twit88.com/home/opensource/qrcode for free (only need to register)



回答8:

You can use zbar directly to decode the qrcode.

#!/usr/bin/python

from sys import argv
import zbar
import Image


# create a reader
scanner = zbar.ImageScanner()

# configure the reader
scanner.parse_config('enable')

# obtain image data    
pil = Image.open("base.png").convert('L')
width, height = pil.size
raw = pil.tostring()

# wrap image data
image = zbar.Image(width, height, 'Y800', raw)

# scan the image for barcodes
scanner.scan(image)

# extract results
for symbol in image:
    # do something useful with results
    print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data

# clean up
del(image)


回答9:

You can try python-qrtools: https://launchpad.net/qr-tools It uses qrencode for generating and zbar for decoding (from webcam or a file ;-)