C# Class zxingwp7.pdf417.detector.Detector

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

Show file Open project: henningms/zxing2.0-wp7 Class Usage Examples

Public Methods

Method Description
Detector ( BinaryBitmap image ) : System
detect ( ) : DetectorResult

Detects a PDF417 Code in an image, simply.

detect ( Object>.Dictionary hints ) : DetectorResult

Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.

Private Methods

Method Description
computeDimension ( ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, ResultPoint bottomRight, float moduleWidth ) : int

Computes the dimension (number of modules in a row) of the PDF417 Code based on vertices of the codeword area and estimated module size.

computeModuleWidth ( ResultPoint vertices ) : float

Estimates module size (pixels in a module) based on the Start and End finder patterns.

correctCodeWordVertices ( ResultPoint vertices, bool upsideDown ) : void

Because we scan horizontally to detect the start and stop patterns, the vertical component of the codeword coordinates will be slightly wrong if there is any skew or rotation in the image. This method moves those points back onto the edges of the theoretically perfect bounding quadrilateral if needed.

findGuardPattern ( BitMatrix matrix, int column, int row, int width, bool whiteFirst, int pattern ) : int[]
findVertices ( BitMatrix matrix ) : ResultPoint[]

Locate the vertices and the codewords area of a black blob using the Start and Stop patterns as locators. Assumes that the barcode begins in the left half of the image, and ends in the right half. TODO: Fix this assumption, allowing the barcode to be anywhere in the image. TODO: Scanning every row is very expensive. We should only do this for TRY_HARDER.

findVertices180 ( BitMatrix matrix ) : ResultPoint[]

Locate the vertices and the codewords area of a black blob using the Start and Stop patterns as locators. This assumes that the image is rotated 180 degrees and if it locates the start and stop patterns at it will re-map the vertices for a 0 degree rotation. TODO: Change assumption about barcode location. TODO: Scanning every row is very expensive. We should only do this for TRY_HARDER.

patternMatchVariance ( int counters, int pattern, int maxIndividualVariance ) : int

Determines how closely a set of observed counts of runs of black/white values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern.

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 matrix, ResultPoint topLeft, ResultPoint bottomLeft, ResultPoint topRight, ResultPoint bottomRight, int dimension ) : BitMatrix

Method Details

Detector() public method

public Detector ( BinaryBitmap image ) : System
image BinaryBitmap
return System

detect() public method

Detects a PDF417 Code in an image, simply.

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

detect() public method

Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.

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