Options
All
  • Public
  • Public/Protected
  • All
Menu

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

author

Sean Owen

Hierarchy

  • Detector

Index

Constructors

constructor

Properties

Private image

image: BitMatrix

Private resultPointCallback

resultPointCallback: ResultPointCallback

Methods

Protected calculateModuleSize

  • Computes an average estimated module size based on estimated derived from the positions of the three finder patterns.

    Parameters

    • topLeft: ResultPoint

      detected top-left finder pattern center

    • topRight: ResultPoint

      detected top-right finder pattern center

    • bottomLeft: ResultPoint

      detected bottom-left finder pattern center

    Returns number

    estimated module size

Private calculateModuleSizeOneWay

  • Estimates module size based on two finder patterns -- it uses {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the width of each, measuring along the axis between their centers.

    Parameters

    Returns number

detect

Protected findAlignmentInRegion

  • findAlignmentInRegion(overallEstModuleSize: number, estAlignmentX: number, estAlignmentY: number, allowanceFactor: number): AlignmentPattern
  • Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. This method uses AlignmentPattern.

    throws

    NotFoundException if an unexpected error occurs during detection

    Parameters

    • overallEstModuleSize: number

      estimated module size so far

    • estAlignmentX: number

      x coordinate of center of area probably containing alignment pattern

    • estAlignmentY: number

      y coordinate of above

    • allowanceFactor: number

      number of pixels in all directions to search from the center

    Returns AlignmentPattern

    AlignmentPattern if found, or null otherwise

Protected getImage

Protected getResultPointCallback

Protected processFinderPatternInfo

Private sizeOfBlackWhiteBlackRun

  • sizeOfBlackWhiteBlackRun(fromX: number, fromY: number, toX: number, toY: number): number
  • This method traces a line from a point in the image, in the direction towards another point. It begins in a black region, and keeps going until it finds white, then black, then white again. It reports the distance from the start to this point.

    This is used when figuring out how wide a finder pattern is, when the finder pattern may be skewed or rotated.

    Parameters

    • fromX: number
    • fromY: number
    • toX: number
    • toY: number

    Returns number

Private sizeOfBlackWhiteBlackRunBothWays

  • sizeOfBlackWhiteBlackRunBothWays(fromX: number, fromY: number, toX: number, toY: number): number
  • See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of a finder pattern by looking for a black-white-black run from the center in the direction of another point (another finder pattern center), and in the opposite direction too.

    Parameters

    • fromX: number
    • fromY: number
    • toX: number
    • toY: number

    Returns number

Static Private computeDimension

Static Private createTransform

Static Private sampleGrid

Generated using TypeDoc