Options
All
  • Public
  • Public/Protected
  • All
Menu
author

Satoru Takabayashi

author

Daniel Switkin

author

Sean Owen

Hierarchy

  • MaskUtil

Index

Constructors

Private constructor

Properties

Static Private N1

N1: number = 3

Static Private N2

N2: number = 3

Static Private N3

N3: number = 40

Static Private N4

N4: number = 10

Methods

Static applyMaskPenaltyRule1

  • applyMaskPenaltyRule1(matrix: ByteMatrix): number

Static Private applyMaskPenaltyRule1Internal

  • applyMaskPenaltyRule1Internal(matrix: ByteMatrix, isHorizontal: boolean): number
  • Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both vertical and horizontal orders respectively.

    Parameters

    Returns number

Static applyMaskPenaltyRule2

  • applyMaskPenaltyRule2(matrix: ByteMatrix): number
  • Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.

    Parameters

    Returns number

Static applyMaskPenaltyRule3

  • applyMaskPenaltyRule3(matrix: ByteMatrix): number
  • Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4 starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we find patterns like 000010111010000, we give penalty once.

    Parameters

    Returns number

Static applyMaskPenaltyRule4

  • applyMaskPenaltyRule4(matrix: ByteMatrix): number
  • Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.

    Parameters

    Returns number

Static getDataMaskBit

  • getDataMaskBit(maskPattern: number, x: number, y: number): boolean
  • Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions.

    Parameters

    • maskPattern: number
    • x: number
    • y: number

    Returns boolean

Static Private isWhiteHorizontal

  • isWhiteHorizontal(rowArray: Uint8Array, from: number, to: number): boolean

Static Private isWhiteVertical

  • isWhiteVertical(array: Uint8Array[], col: number, from: number, to: number): boolean

Generated using TypeDoc