public class Detector extends Object
Encapsulates logic that can detect a QR Code in an image, even if the QR Code is rotated or skewed, or partially obscured.
限定符和类型 | 方法和说明 |
---|---|
protected float |
calculateModuleSize(ResultPoint topLeft,
ResultPoint topRight,
ResultPoint bottomLeft)
Computes an average estimated module size based on estimated derived from the positions
of the three finder patterns.
|
DetectorResult |
detect()
Detects a QR Code in an image, simply.
|
DetectorResult |
detect(Map<DecodeHintType,?> hints)
Detects a QR Code in an image, simply.
|
protected AlignmentPattern |
findAlignmentInRegion(float overallEstModuleSize,
int estAlignmentX,
int estAlignmentY,
float allowanceFactor)
Attempts to locate an alignment pattern in a limited region of the image, which is
guessed to contain it.
|
protected BitMatrix |
getImage() |
protected ResultPointCallback |
getResultPointCallback() |
protected DetectorResult |
processFinderPatternInfo(FinderPatternInfo info) |
public Detector(BitMatrix image)
protected final BitMatrix getImage()
protected final ResultPointCallback getResultPointCallback()
public DetectorResult detect() throws NotFoundException, FormatException
Detects a QR Code in an image, simply.
DetectorResult
encapsulating results of detecting a QR CodeNotFoundException
- if no QR Code can be foundFormatException
public final DetectorResult detect(Map<DecodeHintType,?> hints) throws NotFoundException, FormatException
Detects a QR Code in an image, simply.
hints
- optional hints to detectorNotFoundException
encapsulating results of detecting a QR CodeNotFoundException
- if QR Code cannot be foundFormatException
- if a QR Code cannot be decodedprotected final DetectorResult processFinderPatternInfo(FinderPatternInfo info) throws NotFoundException, FormatException
protected final float calculateModuleSize(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft)
Computes an average estimated module size based on estimated derived from the positions of the three finder patterns.
protected final AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) throws NotFoundException
Attempts to locate an alignment pattern in a limited region of the image, which is
guessed to contain it. This method uses AlignmentPattern
.
overallEstModuleSize
- estimated module size so farestAlignmentX
- x coordinate of center of area probably containing alignment patternestAlignmentY
- y coordinate of aboveallowanceFactor
- number of pixels in all directions to search from the centerAlignmentPattern
if found, or null otherwiseNotFoundException
- if an unexpected error occurs during detectionCopyright © 2007–2014. All rights reserved.