QRDecoders
Documentation for QRDecoders.
QRDecoders.BerlekampMassey
QRDecoders.DecodeError
QRDecoders.Euclidean
QRDecoders.InfoError
QRDecoders.ReedSolomonAlgorithm
QRDecoders.ReedSolomonError
QRDecoders.block2bits
QRDecoders.correct_message
QRDecoders.decodedata
QRDecoders.decodemode
QRDecoders.deinterleave
QRDecoders.extract_databits
QRDecoders.getalterpos
QRDecoders.getqrmatrix
QRDecoders.hamming_distance
QRDecoders.hamming_distance
QRDecoders.hamming_weight
QRDecoders.qrdecode
QRDecoders.qrdecode
QRDecoders.qrdecode_format
QRDecoders.qrdecode_format
QRDecoders.qrdecode_version
QRDecoders.qrdecode_version
QRDecoders.qrdecompose
QRDecoders.trybyte
QRDecoders.tryutf8
QRDecoders.BerlekampMassey
— TypeBerlekampMassey <: ReedSolomonAlgorithm
Berlekamp-Massey algorithm for error correction.
QRDecoders.DecodeError
— TypeDecodeError <: Exception
The data part of QR-matrix contains error.
QRDecoders.Euclidean
— TypeEuclidean <: ReedSolomonAlgorithm
Euclidean algorithm for error correction.
QRDecoders.InfoError
— TypeInfoError <: Exception
The non-data part of QR-matrix contains error.
For example, Finder pattern, Alignment pattern, Timing pattern, Format information, Version information, matrix size and etc.
QRDecoders.ReedSolomonAlgorithm
— TypeReedSolomonAlgorithm
An abstract type for error correction algorithm of Reed Solomon code.
QRDecoders.ReedSolomonError
— TypeReedSolomonError <: Exception
An error occurs during error-correction.
QRDecoders.block2bits
— Methodblock2bits(blocks::AbstractVector)
Convert a block to bits.
QRDecoders.correct_message
— Methodcorrect_message(msgblock::AbstractVector
, ecblock::AbstractVector
, alg::ReedSolomonAlgorithm
; noerror::Bool=false)
Error correction of the message block using the given algorithm.
Throw DecodeError if the value noerror
is true and the message need error correction.
QRDecoders.decodedata
— Methoddecodedata(bits::AbstractVector, msglen::Int, ::Mode)
Decode message from bits
without checking the pad_bits
.
QRDecoders.decodemode
— Methoddecodemode(bits::AbstractVector)
Decode mode from the bits of length 4. Note: the Byte
mode and the UTF8
mode use the same mode indicator(0100).
QRDecoders.deinterleave
— Methoddeinterleave(bytes::AbstractVector, ec::ErrCorrLevel, version::Int)
De-interleave the message, i.e. sperate msgblocks and ecblocks from data bits.
QRDecoders.extract_databits
— Methodextract_databits(mat::AbstractMatrix, datapos::AbstractMatrix)
Extract data bits from the QR-Code.(Inverse procedure of placedata!)
QRDecoders.getalterpos
— Methodgetalterpos(array::AbstractVector)
Get the switch-value indexes of the input array
. It can be used for detecting the finder patterns.
Examples
julis> using QRDecoders: getalterpos
julia> array = Bool[1,1,0,0,0,1,1,0]
julia> getalterpos(array)
3-element Vector{Int64}:
2
5
7
QRDecoders.getqrmatrix
— Methodgetqrmatrix(img)
Get the QR-code matrix from an image.
Note that the input must be a standard QR-code image with or without white border, i.e. the image should not contain any other non-QR-Code information.
QRDecoders.hamming_distance
— Methodhamming_distance(x, y)
Calculate the Hamming distance between two elements.
QRDecoders.hamming_distance
— Methodhamming_distance(C::AbstractVector)
Hamming distance of a linear code.
QRDecoders.hamming_weight
— Methodhamming_weight(x::Poly)
Calculate the Hamming weight of a polynomial.
QRDecoders.qrdecode
— Methodqrdecode(mat::AbstractMatrix
; noerror::Bool=false
, preferutf8::Bool=true
, alg::ReedSolomonAlgorithm=Euclidean()
)::QRInfo
QR code decoder.
If noerror
is true
, the decoder will raise an Exception(ReedSolomonError/InfoError) when the QR code mat
needs error correction.
If preferutf8
is true
, the decoder will try to decode the message by UTF8
mode when dealing with Byte
mode.
The error correction algorithm is specified by the variable alg
(default: Euclidean
).
QRDecoders.qrdecode
— Methodqrdecode(path::AbstractString; keywords...)
QR code decoder.
For more information of the keywords, see qrdecode(mat::AbstractMatrix; keywords...)
.
QRDecoders.qrdecode_format
— Methodqrdecode_format(mat::AbstractMatrix; noerror=false)
Return the format of the QR-Code(ErrCorrLevel + mask).
QRDecoders.qrdecode_format
— Methodqrdecode_format(fmt::Int)::Int
Decode format information.
QRDecoders.qrdecode_version
— Methodqrdecode_version(mat::AbstractMatrix; noerror=false)
Return the version of the QR-Code.(Matrix to Integer)
QRDecoders.qrdecode_version
— Methodqrdecode_version(version::Int)
Decode version information.(Interger to Integer)
QRDecoders.qrdecompose
— Methodqrdecompose(mat::AbstractMatrix, noerror=false)
Decompose the QR-Code into its constituent parts.
QRDecoders.trybyte
— Methodtrybyte(bits::AbstractVector, msglen::Int)
Try decoding message by Byte
mode, where bits
= message_bits
+ pad_bits
. Return true
if the pad_bits
is correct.
QRDecoders.tryutf8
— Methodtryutf8(bits::AbstractVector, msglen::Int)
Try decoding message by utf-8 mode.