QR code (2D barcode) coding and decoding algorithm

2019-01-16 01:17发布

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...

9条回答
太酷不给撩
2楼-- · 2019-01-16 01:46

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

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

查看更多
太酷不给撩
3楼-- · 2019-01-16 01:48

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

查看更多
霸刀☆藐视天下
5楼-- · 2019-01-16 01:54

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)
查看更多
放荡不羁爱自由
6楼-- · 2019-01-16 01:57

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

查看更多
干净又极端
7楼-- · 2019-01-16 01:58

(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.

查看更多
登录 后发表回答