\Zxing\Qrcode\DetectorFinderPatternFinder

<p>This class attempts to find finder patterns in a QR Code. Finder patterns are the square markers at three corners of a QR Code.</p>

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

Summary

Methods
Properties
Constants
__construct()
find()
FurthestFromAverageComparator()
CenterComparator()
No public properties found
No constants found
foundPatternCross()
handlePossibleCenter()
getImage()
getPossibleCenters()
$MIN_SKIP
$MAX_MODULES
N/A
centerFromEnd()
crossCheckVertical()
getCrossCheckStateCount()
crossCheckHorizontal()
crossCheckDiagonal()
haveMultiplyConfirmedCenters()
findRowSkip()
selectBestPatterns()
$CENTER_QUORUM
$image
$average
$possibleCenters
$hasSkipped
$crossCheckStateCount
$resultPointCallback
N/A

Properties

$MIN_SKIP

$MIN_SKIP

$MAX_MODULES

$MAX_MODULES

$CENTER_QUORUM

$CENTER_QUORUM

$image

$image

$average

$average

$possibleCenters

$possibleCenters

$hasSkipped

$hasSkipped

$crossCheckStateCount

$crossCheckStateCount

$resultPointCallback

$resultPointCallback

Methods

__construct()

__construct(\Zxing\Common\BitMatrix  $image, mixed  $resultPointCallback = null) : mixed

<p>Creates a finder that will search the image for three finder patterns.</p>

Parameters

\Zxing\Common\BitMatrix $image

image to search

mixed $resultPointCallback

Returns

mixed —

find()

find(mixed  $hints) : mixed

Parameters

mixed $hints

Returns

mixed —

FurthestFromAverageComparator()

FurthestFromAverageComparator(mixed  $center1, mixed  $center2) : mixed

<p>Orders by furthest from average</p>

Parameters

mixed $center1
mixed $center2

Returns

mixed —

CenterComparator()

CenterComparator(mixed  $center1, mixed  $center2) : mixed

Parameters

mixed $center1
mixed $center2

Returns

mixed —

foundPatternCross()

foundPatternCross( $stateCount) : true

Parameters

$stateCount

; count of black/white/black/white/black pixels just read

Returns

true —

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

handlePossibleCenter()

handlePossibleCenter( $stateCount, mixed  $i, mixed  $j, mixed  $pureBarcode) : true

<p>This is called when a horizontal scan finds a possible alignment pattern. It will cross check with a vertical scan, and if successful, will, ah, cross-cross-check with another horizontal scan. This is needed primarily to locate the real horizontal center of the pattern in cases of extreme skew.

And then we cross-cross-cross check with another diagonal scan.

If that succeeds the finder pattern location is added to a list that tracks the number of times each location has been nearly-matched as a finder pattern. Each additional find is more evidence that the location is in fact a finder pattern center

Parameters

$stateCount

reading state module counts from horizontal scan

mixed $i
mixed $j
mixed $pureBarcode

Returns

true —

if a finder pattern candidate was found this time

getImage()

getImage() : mixed

Returns

mixed —

getPossibleCenters()

getPossibleCenters() : mixed

<p>Orders by {@link FinderPattern#getCount()}, descending.</p>

Returns

mixed —

centerFromEnd()

centerFromEnd(mixed  $stateCount, mixed  $end) : mixed

Given a count of black/white/black/white/black pixels just seen and an end position, figures the location of the center of this run.

Parameters

mixed $stateCount
mixed $end

Returns

mixed —

crossCheckVertical()

crossCheckVertical( $startI, mixed  $centerJ,  $maxCount, mixed  $originalStateCountTotal) : \Zxing\Qrcode\Detector\vertical

<p>After a horizontal scan finds a potential finder pattern, this method "cross-checks" by scanning down vertically through the center of the possible finder pattern to see if the same proportion is detected.</p>

Parameters

$startI

; row where a finder pattern was detected

mixed $centerJ
$maxCount

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

mixed $originalStateCountTotal

Returns

\Zxing\Qrcode\Detector\vertical —

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

getCrossCheckStateCount()

getCrossCheckStateCount() : mixed

Returns

mixed —

crossCheckHorizontal()

crossCheckHorizontal(mixed  $startJ, mixed  $centerI, mixed  $maxCount, mixed  $originalStateCountTotal) : mixed

<p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical, except it reads horizontally instead of vertically. This is used to cross-cross check a vertical cross check and locate the real center of the alignment pattern.</p>

Parameters

mixed $startJ
mixed $centerI
mixed $maxCount
mixed $originalStateCountTotal

Returns

mixed —

crossCheckDiagonal()

crossCheckDiagonal( $startI, mixed  $centerJ,  $maxCount, mixed  $originalStateCountTotal) : true

After a vertical and horizontal scan finds a potential finder pattern, this method "cross-cross-cross-checks" by scanning down diagonally through the center of the possible finder pattern to see if the same proportion is detected.

Parameters

$startI

; row where a finder pattern was detected

mixed $centerJ
$maxCount

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

mixed $originalStateCountTotal

Returns

true —

if proportions are withing expected limits

haveMultiplyConfirmedCenters()

haveMultiplyConfirmedCenters() : true

Returns

true —

iff we have found at least 3 finder patterns that have been detected at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the candidates is "pretty similar"

findRowSkip()

findRowSkip() : \Zxing\Qrcode\Detector\number

Returns

\Zxing\Qrcode\Detector\number —

of rows we could safely skip during scanning, based on the first two finder patterns that have been located. In some cases their position will allow us to infer that the third pattern must lie below a certain point farther down in the image.

selectBestPatterns()

selectBestPatterns() : array

Throws

\Zxing\NotFoundException

if 3 such finder patterns do not exist

Returns

array —

the 3 best {@link FinderPattern}s from our list of candidates. The "best" are those that have been detected at least {@link #CENTER_QUORUM} times, and whose module size differs from the average among those patterns the least