ZXingCPP.jl is a Julia wrapper for the C++ library zxing-cpp. It is an open-source, multi-format linear/matrix barcode image processing library implemented in C++.
ZXingCPP.jl provides fast and accurate barcode detection, decoding and creation within Julia.
ZXingCPP.jl integrated with Images.jl and OpenCV.jl. Both packages can used to read and write barcode images.
using ZXingCPP
using ImageCore
using FileIO
using ImageIO
Create:
f = ZXing_BarcodeFormat_QRCode
co = CreatorOptions(f)
bc = Barcode("HELLO WORLD", co)
print(bc)
Write:
wo = WriterOptions(; scale=10)
zimg = write_barcode_to_image(bc, wo)
jimg = Matrix(zimg)
save("barcode.png", jimg)
Read:
img = load("barcode.png")
ro = ReaderOptions(; formats=ZXing_BarcodeFormat_QRCode)
bcs = read_barcodes(img, ro)
print(bcs)
Pluto notebook with annotation example using Images.jl
found at here
using ZXingCPP
using OpenCV
Create:
f = ZXing_BarcodeFormat_QRCode
co = CreatorOptions(f)
bc = Barcode("HELLO WORLD", co)
print(bc)
Write:
wo = WriterOptions(; scale=10)
zimg = write_barcode_to_image(bc, wo)
cvimg = OpenCV.Mat(zimg)
OpenCV.imwrite("barcode.png", cvimg)
Read:
img = OpenCV.imread("barcode.png", OpenCV.IMREAD_UNCHANGED)
ro = ReaderOptions(; formats=ZXing_BarcodeFormat_QRCode)
bcs = read_barcodes(img, ro)
print(bcs)
Pluto notebook with annotation example using OpenCV.jl
found at here