Documentation

Detector
in package

FinalYes

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

Tags
author

Sean Owen

Table of Contents

Properties

$matrix  : BitMatrix

Methods

__construct()  : mixed
Detector constructor.
detect()  : BitMatrix
Detects a QR Code in an image.
calculateModuleSize()  : float
Computes an average estimated module size based on estimated derived from the positions of the three finder patterns.
calculateModuleSizeOneWay()  : float
Estimates module size based on two finder patterns -- it uses #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int) to figure the width of each, measuring along the axis between their centers.
computeDimension()  : int
Computes the dimension (number of modules on a size) of the QR Code based on the position of the finder patterns and estimated module size.
createTransform()  : PerspectiveTransform
findAlignmentInRegion()  : AlignmentPattern|null
Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it.
sizeOfBlackWhiteBlackRun()  : float
This method traces a line from a po$in the image, in the direction towards another point.
sizeOfBlackWhiteBlackRunBothWays()  : float
See #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 po$(another finder pattern center), and in the opposite direction too.

Properties

Methods

calculateModuleSizeOneWay()

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

private calculateModuleSizeOneWay(FinderPattern $a, FinderPattern $b) : float
Parameters
$a : FinderPattern
$b : FinderPattern
Return values
float

findAlignmentInRegion()

Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it.

private findAlignmentInRegion(float $overallEstModuleSize, int $estAlignmentX, int $estAlignmentY, float $allowanceFactor) : AlignmentPattern|null
Parameters
$overallEstModuleSize : float

estimated module size so far

$estAlignmentX : int

x coordinate of center of area probably containing alignment pattern

$estAlignmentY : int

y coordinate of above

$allowanceFactor : float

number of pixels in all directions to search from the center

Return values
AlignmentPattern|null

if found, or null otherwise

sizeOfBlackWhiteBlackRun()

This method traces a line from a po$in the image, in the direction towards another point.

private sizeOfBlackWhiteBlackRun(int $fromX, int $fromY, int $toX, int $toY) : float

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 : int
$fromY : int
$toX : int
$toY : int
Return values
float

sizeOfBlackWhiteBlackRunBothWays()

See #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 po$(another finder pattern center), and in the opposite direction too.

private sizeOfBlackWhiteBlackRunBothWays(float $fromX, float $fromY, float $toX, float $toY) : float
Parameters
$fromX : float
$fromY : float
$toX : float
$toY : float
Tags
noinspection

DuplicatedCode

Return values
float

        
On this page

Search results