def insertQR(image, data):
'''
@params:
image is the image that we'll be messing with
data is what will be encoded in the QR code
inserts a QR code into the image at the specified bounds
the new qr code should fit the bounds and seem natural (like it was the original imge)
'''
qr_gen = qrcode.QRCode(
version = None,
box_size = 4,
border = 0
);
qr_gen.add_data(data)
qr_gen.make(fit=True)
qrCode = qr_gen.make_image()
pgram = scanImage2(image)
#pgram = expandParallelogram(pgram, 15)
return warpImage(image, qrCode, pgram)
评论列表
文章目录