import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DetectorResult;
-import com.google.zxing.common.GenericResultPoint;
import com.google.zxing.common.GridSampler;
import com.google.zxing.qrcode.decoder.Version;
*
* @author Sean Owen
*/
-public final class Detector {
+public class Detector {
private final MonochromeBitmapSource image;
this.image = image;
}
+ protected MonochromeBitmapSource getImage() {
+ return image;
+ }
+
/**
* <p>Detects a QR Code in an image, simply.</p>
*
FinderPatternFinder finder = new FinderPatternFinder(image);
FinderPatternInfo info = finder.find(hints);
+ return processFinderPatternInfo(info);
+ }
+
+ protected DetectorResult processFinderPatternInfo(FinderPatternInfo info) throws ReaderException {
+
FinderPattern topLeft = info.getTopLeft();
FinderPattern topRight = info.getTopRight();
FinderPattern bottomLeft = info.getBottomLeft();
// try next round
}
}
- if (alignmentPattern == null) {
- throw ReaderException.getInstance();
- }
-
+ // If we didn't find alignment pattern... well try anyway without it
}
BitMatrix bits = sampleGrid(image, topLeft, topRight, bottomLeft, alignmentPattern, dimension);
ResultPoint topRight,
ResultPoint bottomLeft,
float moduleSize) throws ReaderException {
- int tltrCentersDimension = round(GenericResultPoint.distance(topLeft, topRight) / moduleSize);
- int tlblCentersDimension = round(GenericResultPoint.distance(topLeft, bottomLeft) / moduleSize);
+ int tltrCentersDimension = round(ResultPoint.distance(topLeft, topRight) / moduleSize);
+ int tlblCentersDimension = round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
int dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
switch (dimension & 0x03) { // mod 4
case 0: