C# Class zxingwp7.qrcode.detector.Detector

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

ファイルを表示 Open project: henningms/zxing2.0-wp7 Class Usage Examples

Public Methods

Method Description
Detector ( BitMatrix image ) : System
createTransform ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, ResultPoint alignmentPattern, int dimension ) : PerspectiveTransform
detect ( ) : DetectorResult

Detects a QR Code in an image, simply.

detect ( Object>.Dictionary hints ) : DetectorResult

Detects a QR Code in an image, simply.

Protected Methods

Method Description
calculateModuleSize ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft ) : float

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

computeDimension ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, float moduleSize ) : 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.

findAlignmentInRegion ( float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor ) : AlignmentPattern

Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. This method uses {@link AlignmentPattern}.

processFinderPatternInfo ( FinderPatternInfo info ) : DetectorResult

Private Methods

Method Description
calculateModuleSizeOneWay ( ResultPoint pattern, ResultPoint otherPattern ) : float

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.

round ( float d ) : int

Ends up being a bit faster than Math.round(). This merely rounds its argument to the nearest int, where x.5 rounds up.

sampleGrid ( BitMatrix image, PerspectiveTransform transform, int dimension ) : BitMatrix
sizeOfBlackWhiteBlackRun ( int fromX, int fromY, int toX, int toY ) : float

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.

sizeOfBlackWhiteBlackRunBothWays ( int fromX, int fromY, int toX, int toY ) : float

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.

Method Details

Detector() public method

public Detector ( BitMatrix image ) : System
image zxingwp7.common.BitMatrix
return System

calculateModuleSize() protected method

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

protected calculateModuleSize ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft ) : float
topLeft ResultPoint
topRight ResultPoint
bottomLeft ResultPoint
return float

computeDimension() protected static method

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.

protected static computeDimension ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, float moduleSize ) : int
topLeft ResultPoint
topRight ResultPoint
bottomLeft ResultPoint
moduleSize float
return int

createTransform() public method

public createTransform ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, ResultPoint alignmentPattern, int dimension ) : PerspectiveTransform
topLeft ResultPoint
topRight ResultPoint
bottomLeft ResultPoint
alignmentPattern ResultPoint
dimension int
return zxingwp7.common.PerspectiveTransform

detect() public method

Detects a QR Code in an image, simply.

public detect ( ) : DetectorResult
return zxingwp7.common.DetectorResult

detect() public method

Detects a QR Code in an image, simply.

public detect ( Object>.Dictionary hints ) : DetectorResult
hints Object>.Dictionary optional hints to detector ///
return zxingwp7.common.DetectorResult

findAlignmentInRegion() protected method

Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. This method uses {@link AlignmentPattern}.

protected findAlignmentInRegion ( float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor ) : AlignmentPattern
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 AlignmentPattern

processFinderPatternInfo() protected method

protected processFinderPatternInfo ( FinderPatternInfo info ) : DetectorResult
info FinderPatternInfo
return zxingwp7.common.DetectorResult