Options
All
  • Public
  • Public/Protected
  • All
Menu

Encapsulates logic that can detect a PDF417 Code in an image, even if the PDF417 Code is rotated or skewed, or partially obscured.

author

SITA Lab (kevin.osullivan@sita.aero)

author

dswitkin@google.com (Daniel Switkin)

author

Guenther Grau

Hierarchy

  • Detector

Index

Properties

Static Private BARCODE_MIN_HEIGHT

BARCODE_MIN_HEIGHT: number = 10

Static Private INDEXES_START_PATTERN

INDEXES_START_PATTERN: Int32Array = Int32Array.from([0, 4, 1, 5])

Static Private INDEXES_STOP_PATTERN

INDEXES_STOP_PATTERN: Int32Array = Int32Array.from([6, 2, 7, 3])

Static Private MAX_AVG_VARIANCE

MAX_AVG_VARIANCE: float = 0.42

Static Private MAX_INDIVIDUAL_VARIANCE

MAX_INDIVIDUAL_VARIANCE: float = 0.8

Static Private MAX_PATTERN_DRIFT

MAX_PATTERN_DRIFT: number = 5

Static Private MAX_PIXEL_DRIFT

MAX_PIXEL_DRIFT: number = 3

Static Private ROW_STEP

ROW_STEP: number = 5

Static Private SKIPPED_ROW_COUNT_MAX

SKIPPED_ROW_COUNT_MAX: number = 25

Static Private START_PATTERN

START_PATTERN: Int32Array = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3])

Static Private STOP_PATTERN

STOP_PATTERN: Int32Array = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1])

Methods

Static Private copyToResult

Static Private detect

  • Detects PDF417 codes in an image. Only checks 0 degree rotation

    Parameters

    • multiple: boolean

      if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned

    • bitMatrix: BitMatrix

      bit matrix to detect barcodes in

    Returns Array<ResultPoint[]>

    List of ResultPoint arrays containing the coordinates of found barcodes

Static detectMultiple

  • Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.

    throws

    NotFoundException if no PDF417 Code can be found

    Parameters

    • image: BinaryBitmap

      barcode image to decode

    • hints: Map<DecodeHintType, any>

      optional hints to detector

    • multiple: boolean

      if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned

    Returns PDF417DetectorResult

    PDF417DetectorResult encapsulating results of detecting a PDF417 code

Static Private findGuardPattern

  • findGuardPattern(matrix: BitMatrix, column: number, row: number, width: number, whiteFirst: boolean, pattern: Int32Array, counters: Int32Array): Int32Array
  • Parameters

    • matrix: BitMatrix

      row of black/white values to search

    • column: number

      x position to start search

    • row: number

      y position to start search

    • width: number

      the number of pixels to search on this row

    • whiteFirst: boolean
    • pattern: Int32Array

      pattern of counts of number of black and white pixels that are being searched for as a pattern

    • counters: Int32Array

      array of counters, as long as pattern, to re-use

    Returns Int32Array

    start/end horizontal offset of guard pattern, as an array of two ints.

Static Private findRowsWithPattern

  • findRowsWithPattern(matrix: BitMatrix, height: number, width: number, startRow: number, startColumn: number, pattern: Int32Array): ResultPoint[]

Static Private findVertices

  • Locate the vertices and the codewords area of a black blob using the Start and Stop patterns as locators.

    Parameters

    • matrix: BitMatrix

      the scanned barcode image.

    • startRow: number
    • startColumn: number

    Returns ResultPoint[]

    an array containing the vertices: vertices[0] x, y top left barcode vertices[1] x, y bottom left barcode vertices[2] x, y top right barcode vertices[3] x, y bottom right barcode vertices[4] x, y top left codeword area vertices[5] x, y bottom left codeword area vertices[6] x, y top right codeword area vertices[7] x, y bottom right codeword area

Static Private patternMatchVariance

  • patternMatchVariance(counters: Int32Array, pattern: Int32Array, maxIndividualVariance: float): float
  • 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.

    Parameters

    • counters: Int32Array

      observed counters

    • pattern: Int32Array

      expected pattern

    • maxIndividualVariance: float

      The most any counter can differ before we give up

    Returns float

    ratio of total variance between counters and pattern compared to total pattern size

Generated using TypeDoc