From: srowen Date: Mon, 13 Sep 2010 09:12:02 +0000 (+0000) Subject: Another minor change to WhiteRectangleDetector and update "about" screen in Android... X-Git-Url: http://git.rot13.org/?p=zxing.git;a=commitdiff_plain;h=d5d316d0006525e1d8b02fc3ab0e23bd12b0d618 Another minor change to WhiteRectangleDetector and update "about" screen in Android to mention Data Matrix git-svn-id: http://zxing.googlecode.com/svn/trunk@1586 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- diff --git a/android/assets/html/about2d.html b/android/assets/html/about2d.html index 224234f8..fc5a2400 100644 --- a/android/assets/html/about2d.html +++ b/android/assets/html/about2d.html @@ -4,8 +4,9 @@ -

Barcode Scanner also understands how to read two dimensional barcodes, called QR - Codes. For example, the QR Code below contains a hyperlink to the ZXing Project home page:

+

Barcode Scanner also understands how to read two dimensional barcodes, like QR + Codes and Data Matrix codes. + For example, the QR Code below contains a hyperlink to the ZXing Project home page:

QR code

You can also represent contact information in a QR Code, and put it on a business card or web site. When you scan it, the results screen provides a choice of actions:

diff --git a/core/src/com/google/zxing/common/detector/WhiteRectangleDetector.java b/core/src/com/google/zxing/common/detector/WhiteRectangleDetector.java index 38adbaa7..93af0bcc 100644 --- a/core/src/com/google/zxing/common/detector/WhiteRectangleDetector.java +++ b/core/src/com/google/zxing/common/detector/WhiteRectangleDetector.java @@ -33,6 +33,7 @@ import com.google.zxing.common.BitMatrix; public final class WhiteRectangleDetector { private static final int INIT_SIZE = 40; + private static final int CORR = 1; private final BitMatrix image; private final int height; @@ -60,10 +61,10 @@ public final class WhiteRectangleDetector { */ public ResultPoint[] detect() throws NotFoundException { - int left = (width - INIT_SIZE) / 2; - int right = (width + INIT_SIZE) / 2; - int up = (height - INIT_SIZE) / 2; - int down = (height + INIT_SIZE) / 2; + int left = (width - INIT_SIZE) >> 1; + int right = (width + INIT_SIZE) >> 1; + int up = (height - INIT_SIZE) >> 1; + int down = (height + INIT_SIZE) >> 1; boolean sizeExceeded = false; boolean aBlackPointFoundOnBorder = true; boolean atLeastOneBlackPointFoundOnBorder = false; @@ -148,11 +149,10 @@ public final class WhiteRectangleDetector { if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) { - ResultPoint x = null, y = null, z = null, t = null; + int maxSize = right - left; - final int max_size = right - left; - - for (int i = 1; i < max_size; i++) { + ResultPoint z = null; + for (int i = 1; i < maxSize; i++) { z = getBlackPointOnSegment(left, down - i, left + i, down); if (z != null) { break; @@ -163,8 +163,9 @@ public final class WhiteRectangleDetector { throw NotFoundException.getNotFoundInstance(); } + ResultPoint t = null; //go down right - for (int i = 1; i < max_size; i++) { + for (int i = 1; i < maxSize; i++) { t = getBlackPointOnSegment(left, up + i, left + i, up); if (t != null) { break; @@ -175,8 +176,9 @@ public final class WhiteRectangleDetector { throw NotFoundException.getNotFoundInstance(); } + ResultPoint x = null; //go down left - for (int i = 1; i < max_size; i++) { + for (int i = 1; i < maxSize; i++) { x = getBlackPointOnSegment(right, up + i, right - i, up); if (x != null) { break; @@ -187,8 +189,9 @@ public final class WhiteRectangleDetector { throw NotFoundException.getNotFoundInstance(); } + ResultPoint y = null; //go up left - for (int i = 1; i < max_size; i++) { + for (int i = 1; i < maxSize; i++) { y = getBlackPointOnSegment(right, down - i, right - i, down); if (y != null) { break; @@ -267,19 +270,18 @@ public final class WhiteRectangleDetector { float ti = t.getX(); float tj = t.getY(); - final int corr = 1; if (yi < width / 2) { return new ResultPoint[]{ - new ResultPoint(ti - corr, tj + corr), - new ResultPoint(zi + corr, zj + corr), - new ResultPoint(xi - corr, xj - corr), - new ResultPoint(yi + corr, yj - corr)}; + new ResultPoint(ti - CORR, tj + CORR), + new ResultPoint(zi + CORR, zj + CORR), + new ResultPoint(xi - CORR, xj - CORR), + new ResultPoint(yi + CORR, yj - CORR)}; } else { return new ResultPoint[]{ - new ResultPoint(ti + corr, tj + corr), - new ResultPoint(zi + corr, zj - corr), - new ResultPoint(xi - corr, xj + corr), - new ResultPoint(yi - corr, yj - corr)}; + new ResultPoint(ti + CORR, tj + CORR), + new ResultPoint(zi + CORR, zj - CORR), + new ResultPoint(xi - CORR, xj + CORR), + new ResultPoint(yi - CORR, yj - CORR)}; } }