Decoder
in package
The main class which implements QR Code decoding -- as opposed to locating and extracting the QR Code from an image.
Tags
Table of Contents
- decode() : DecoderResult
- Decodes a QR Code represented as a BitMatrix.
- correctErrors() : array<string|int, mixed>
- Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.
- decodeBitStream() : DecoderResult
- decodeMatrix() : DecoderResult
- getDataBlocks() : array<string|int, mixed>
- When QR Codes use multiple data blocks, they are actually interleaved.
Methods
decode()
Decodes a QR Code represented as a BitMatrix.
public
decode(LuminanceSourceInterface $source) : DecoderResult
A 1 or "true" is taken to mean a black module.
Parameters
- $source : LuminanceSourceInterface
Tags
Return values
DecoderResult —text and bytes encoded within the QR Code
correctErrors()
Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.
private
correctErrors(array<string|int, mixed> $codewordBytes, int $numDataCodewords) : array<string|int, mixed>
Parameters
- $codewordBytes : array<string|int, mixed>
- $numDataCodewords : int
Return values
array<string|int, mixed> —decodeBitStream()
private
decodeBitStream(array<string|int, mixed> $bytes, Version $version, EccLevel $ecLevel) : DecoderResult
Parameters
Tags
Return values
DecoderResult —decodeMatrix()
private
decodeMatrix(BitMatrix $bitMatrix) : DecoderResult
Parameters
- $bitMatrix : BitMatrix
Return values
DecoderResult —getDataBlocks()
When QR Codes use multiple data blocks, they are actually interleaved.
private
getDataBlocks(array<string|int, mixed> $rawCodewords, Version $version, EccLevel $eccLevel) : array<string|int, mixed>
That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.
Parameters
- $rawCodewords : array<string|int, mixed>
-
bytes as read directly from the QR Code
- $version : Version
-
version of the QR Code
- $eccLevel : EccLevel
-
error-correction level of the QR Code
Tags
Return values
array<string|int, mixed> —DataBlocks containing original bytes, "de-interleaved" from representation in the QR Code