com.google.zxing.qrcode.detector
Class Detector

java.lang.Object
  extended by com.google.zxing.qrcode.detector.Detector
Direct Known Subclasses:
MultiDetector

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.

Since:
BlackBerry API 6.0.0

Constructor Summary
Detector(BitMatrix image)
           
 
Method Summary
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.
protected static int computeDimension(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, float moduleSize)
          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.
 PerspectiveTransform createTransform(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, ResultPoint alignmentPattern, int dimension)
           
 DetectorResult detect()
          Detects a QR Code in an image, simply.
 DetectorResult detect(Hashtable 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

Detector

public Detector(BitMatrix image)
Since:
BlackBerry API 6.0.0


Method Detail

getImage

protected BitMatrix getImage()
Since:
BlackBerry API 6.0.0

getResultPointCallback

protected ResultPointCallback getResultPointCallback()
Since:
BlackBerry API 7.0.0

detect

public DetectorResult detect()
                      throws NotFoundException,
                             FormatException

Detects a QR Code in an image, simply.

Returns:
DetectorResult encapsulating results of detecting a QR Code
Throws:
NotFoundException - if no QR Code can be found
FormatException
Since:
BlackBerry API 6.0.0

detect

public DetectorResult detect(Hashtable hints)
                      throws NotFoundException,
                             FormatException

Detects a QR Code in an image, simply.

Parameters:
hints - optional hints to detector
Returns:
NotFoundException encapsulating results of detecting a QR Code
Throws:
NotFoundException - if QR Code cannot be found
FormatException - if a QR Code cannot be decoded
Since:
BlackBerry API 6.0.0

processFinderPatternInfo

protected DetectorResult processFinderPatternInfo(FinderPatternInfo info)
                                           throws NotFoundException,
                                                  FormatException
Throws:
NotFoundException
FormatException
Since:
BlackBerry API 6.0.0

createTransform

public PerspectiveTransform createTransform(ResultPoint topLeft,
                                            ResultPoint topRight,
                                            ResultPoint bottomLeft,
                                            ResultPoint alignmentPattern,
                                            int dimension)
Since:
BlackBerry API 7.0.0

computeDimension

protected static int computeDimension(ResultPoint topLeft,
                                      ResultPoint topRight,
                                      ResultPoint bottomLeft,
                                      float moduleSize)
                               throws NotFoundException

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.

Throws:
NotFoundException
Since:
BlackBerry API 7.0.0

calculateModuleSize

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.

Since:
BlackBerry API 7.0.0

findAlignmentInRegion

protected 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.

Parameters:
overallEstModuleSize - estimated module size so far
estAlignmentX - x coordinate of center of area probably containing alignment pattern
estAlignmentY - y coordinate of above
allowanceFactor - number of pixels in all directions to search from the center
Returns:
AlignmentPattern if found, or null otherwise
Throws:
NotFoundException - if an unexpected error occurs during detection
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal