TOneDReader Class

Definition

Encapsulates functionality and implementation that is common to all families of one-dimensional barcodes.

Delphi
type TOneDReader = class(TInterfacedObject)
Inheritance
TInterfacedObject
TOneDReader
Derived
Implements

Constants

Methods

RecordPatternInReverse(IBitArray, Integer, TArray<Integer>)

Records the pattern in reverse.

decode(TBinaryBitmap)

Locates and decodes a barcode in some format within an image.

decode(TBinaryBitmap, TDictionary<TDecodeHintType,TObject>)

Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. Note that we don't try rotation without the try harder flag, even if rotation was supported.

decodeRow(Integer, IBitArray, TDictionary<TDecodeHintType,TObject>)

Attempts to decode a one-dimensional barcode format given a single row of an image.

doDecode(TBinaryBitmap, TDictionary<TDecodeHintType,TObject>)

We're going to examine rows from the middle outward, searching alternately above and below the middle, and farther out each time. rowStep is the number of rows between each successive attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then middle + rowStep, then middle - (2 * rowStep), etc. rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily decided that moving up and down by about 1/16 of the image is pretty good; we try more of the image if "trying harder".

patternMatchVariance(TArray<Integer>, TOneDPattern, Integer)

Determines how closely a set of observed counts of runs of black/white values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern.

recordPattern(IBitArray, Integer, TArray<Integer>)

Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white pixels starting from that point; likewise it is the count of a run of black pixels if the row begin on a black pixels at that point.

reset

Resets any internal state the implementation has after a decode, to prepare it for reuse.