Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AlignmentPatternFinder

This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder patterns but are smaller and appear at regular intervals throughout the image.

At the moment this only looks for the bottom-right alignment pattern.

This is mostly a simplified copy of FinderPatternFinder. It is copied, pasted and stripped down here for maximum performance but does unfortunately duplicate some code.

This class is thread-safe but not reentrant. Each thread must allocate its own object.

author

Sean Owen

Hierarchy

  • AlignmentPatternFinder

Index

Constructors

constructor

Properties

Private crossCheckStateCount

crossCheckStateCount: Int32Array

Private height

height: number

height of region to search

Private image

image: BitMatrix

image to search

Private moduleSize

moduleSize: number

estimated module size so far

Private possibleCenters

possibleCenters: AlignmentPattern[]

Private resultPointCallback

resultPointCallback: ResultPointCallback

Private startX

startX: number

left column from which to start searching

Private startY

startY: number

top row from which to start searching

Private width

width: number

width of region to search

Methods

Private crossCheckVertical

  • crossCheckVertical(startI: number, centerJ: number, maxCount: number, originalStateCountTotal: number): number
  • After a horizontal scan finds a potential alignment pattern, this method "cross-checks" by scanning down vertically through the center of the possible alignment pattern to see if the same proportion is detected.

    Parameters

    • startI: number

      row where an alignment pattern was detected

    • centerJ: number

      center of the section that appears to cross an alignment pattern

    • maxCount: number

      maximum reasonable number of modules that should be observed in any reading state, based on the results of the horizontal scan

    • originalStateCountTotal: number

    Returns number

    vertical center of alignment pattern, or {@link Float#NaN} if not found

find

Private foundPatternCross

  • foundPatternCross(stateCount: Int32Array): boolean
  • Parameters

    • stateCount: Int32Array

      count of black/white/black pixels just read

    Returns boolean

    true iff the proportions of the counts is close enough to the 1/1/1 ratios used by alignment patterns to be considered a match

Private handlePossibleCenter

  • handlePossibleCenter(stateCount: Int32Array, i: number, j: number): AlignmentPattern
  • This is called when a horizontal scan finds a possible alignment pattern. It will cross check with a vertical scan, and if successful, will see if this pattern had been found on a previous horizontal scan. If so, we consider it confirmed and conclude we have found the alignment pattern.

    Parameters

    • stateCount: Int32Array

      reading state module counts from horizontal scan

    • i: number

      row where alignment pattern may be found

    • j: number

      end of possible alignment pattern in row

    Returns AlignmentPattern

    AlignmentPattern if we have found the same pattern twice, or null if not

Static Private centerFromEnd

  • centerFromEnd(stateCount: Int32Array, end: number): number

Generated using TypeDoc