decodeDigit

fun decodeDigit(row: BitArray, counters: IntArray, rowOffset: Int, patterns: Array<IntArray>): Int

Attempts to decode a single UPC/EAN-encoded digit.

Return

horizontal offset of first pixel beyond the decoded digit

Parameters

row

row of black/white values to decode

counters

the counts of runs of observed black/white/black/... values

rowOffset

horizontal offset to start decoding from

patterns

the set of patterns to use to decode -- sometimes different encodings for the digits 0-9 are used, and this indicates the encodings for 0 to 9 that should be used

Throws

if digit cannot be decoded