mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Various code tweaks and refactorings suggested by IntelliJ
git-svn-id: https://zxing.googlecode.com/svn/trunk@246 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
c82d0790c3
commit
a78f7f40d5
|
@ -176,20 +176,20 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
}
|
||||
|
||||
private static boolean canBeHandled(ParsedReaderResultType type) {
|
||||
return type != ParsedReaderResultType.TEXT;
|
||||
return !type.equals(ParsedReaderResultType.TEXT);
|
||||
}
|
||||
|
||||
private static int getDialogTitleID(ParsedReaderResultType type) {
|
||||
if (type == ParsedReaderResultType.ADDRESSBOOK) {
|
||||
if (type.equals(ParsedReaderResultType.ADDRESSBOOK)) {
|
||||
return R.string.title_add_contact;
|
||||
} else if (type == ParsedReaderResultType.URI ||
|
||||
type == ParsedReaderResultType.BOOKMARK ||
|
||||
type == ParsedReaderResultType.URLTO) {
|
||||
} else if (type.equals(ParsedReaderResultType.URI) ||
|
||||
type.equals(ParsedReaderResultType.BOOKMARK) ||
|
||||
type.equals(ParsedReaderResultType.URLTO)) {
|
||||
return R.string.title_open_url;
|
||||
} else if (type == ParsedReaderResultType.EMAIL ||
|
||||
type == ParsedReaderResultType.EMAIL_ADDRESS) {
|
||||
} else if (type.equals(ParsedReaderResultType.EMAIL) ||
|
||||
type.equals(ParsedReaderResultType.EMAIL_ADDRESS)) {
|
||||
return R.string.title_compose_email;
|
||||
} else if (type == ParsedReaderResultType.UPC) {
|
||||
} else if (type.equals(ParsedReaderResultType.UPC)) {
|
||||
return R.string.title_lookup_barcode;
|
||||
} else {
|
||||
return R.string.title_barcode_detected;
|
||||
|
|
|
@ -38,15 +38,15 @@ final class CameraManager {
|
|||
|
||||
private static final String TAG = "CameraManager";
|
||||
|
||||
private Context context;
|
||||
private final Context context;
|
||||
private Point cameraResolution;
|
||||
private Point stillResolution;
|
||||
private int stillMultiplier;
|
||||
private Point screenResolution;
|
||||
private Rect framingRect;
|
||||
private Bitmap bitmap;
|
||||
private final Bitmap bitmap;
|
||||
private CameraDevice camera;
|
||||
private CameraDevice.CaptureParams params;
|
||||
private final CameraDevice.CaptureParams params;
|
||||
private boolean previewMode;
|
||||
|
||||
CameraManager(Context context) {
|
||||
|
@ -200,7 +200,7 @@ final class CameraManager {
|
|||
|
||||
// The camera driver can only capture images which are a multiple of eight, so it's necessary to
|
||||
// round up.
|
||||
nativeResolution = (nativeResolution + 7) / 8 * 8;
|
||||
nativeResolution = ((nativeResolution + 7) >> 3) << 3;
|
||||
if (nativeResolution > minDimension) {
|
||||
nativeResolution = minDimension;
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ final class CameraSurfaceView extends SurfaceView implements SurfaceHolder.Callb
|
|||
|
||||
private static final int[] SCANNER_ALPHA = {0, 64, 128, 192, 255, 192, 128, 64};
|
||||
|
||||
private CameraManager cameraManager;
|
||||
private SurfaceHolder surfaceHolder;
|
||||
private final CameraManager cameraManager;
|
||||
private final SurfaceHolder surfaceHolder;
|
||||
private boolean hasSurface;
|
||||
private int scannerAlpha;
|
||||
|
||||
|
|
|
@ -25,9 +25,6 @@ package com.google.zxing;
|
|||
*/
|
||||
public final class ReaderException extends Exception {
|
||||
|
||||
public ReaderException() {
|
||||
}
|
||||
|
||||
public ReaderException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class URIParsedResult extends ParsedReaderResult {
|
|||
* Transforms a string that possibly represents a URI into something more proper, by adding or canonicalizing
|
||||
* the protocol.
|
||||
*/
|
||||
static String massagePossibleURI(String uri) {
|
||||
private static String massagePossibleURI(String uri) {
|
||||
// Take off leading "URL:" if present
|
||||
if (uri.startsWith("URL:")) {
|
||||
uri = uri.substring(4);
|
||||
|
|
|
@ -24,7 +24,7 @@ package com.google.zxing.common;
|
|||
public final class BitArray {
|
||||
|
||||
private int[] bits;
|
||||
private int size;
|
||||
private final int size;
|
||||
|
||||
public BitArray(int size) {
|
||||
this.size = size;
|
||||
|
|
|
@ -90,7 +90,7 @@ public final class GF256 {
|
|||
*
|
||||
* @return sum/difference of a and b
|
||||
*/
|
||||
int addOrSubtract(int a, int b) {
|
||||
static int addOrSubtract(int a, int b) {
|
||||
return a ^ b;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,17 +99,18 @@ final class GF256Poly {
|
|||
// Just the sum of the coefficients
|
||||
int result = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
result = field.addOrSubtract(result, coefficients[i]);
|
||||
result = GF256.addOrSubtract(result, coefficients[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int result = coefficients[0];
|
||||
for (int i = 1; i < size; i++) {
|
||||
result = field.addOrSubtract(field.multiply(a, result), coefficients[i]);
|
||||
result = GF256.addOrSubtract(field.multiply(a, result), coefficients[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
int evaluateFormatDerivativeAt(int a) {
|
||||
int degree = getDegree();
|
||||
if (degree == 0) {
|
||||
|
@ -126,6 +127,7 @@ final class GF256Poly {
|
|||
}
|
||||
return sum;
|
||||
}
|
||||
*/
|
||||
|
||||
GF256Poly addOrSubtract(GF256Poly other) {
|
||||
if (!field.equals(other.field)) {
|
||||
|
@ -151,7 +153,7 @@ final class GF256Poly {
|
|||
System.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
|
||||
|
||||
for (int i = lengthDiff; i < largerCoefficients.length; i++) {
|
||||
sumDiff[i] = field.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
|
||||
sumDiff[i] = GF256.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
|
||||
}
|
||||
|
||||
return new GF256Poly(field, sumDiff);
|
||||
|
@ -172,7 +174,7 @@ final class GF256Poly {
|
|||
for (int i = 0; i < aLength; i++) {
|
||||
int aCoeff = aCoefficients[i];
|
||||
for (int j = 0; j < bLength; j++) {
|
||||
product[i + j] = field.addOrSubtract(product[i + j],
|
||||
product[i + j] = GF256.addOrSubtract(product[i + j],
|
||||
field.multiply(aCoeff, bCoefficients[j]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class ReedSolomonDecoder {
|
|||
int[] errorMagnitudes = findErrorMagnitudes(sigmaOmega[1], errorLocations);
|
||||
for (int i = 0; i < errorLocations.length; i++) {
|
||||
int position = received.length - 1 - field.log(errorLocations[i]);
|
||||
received[position] = field.addOrSubtract(received[position], errorMagnitudes[i]);
|
||||
received[position] = GF256.addOrSubtract(received[position], errorMagnitudes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public final class ReedSolomonDecoder {
|
|||
for (int j = 0; j < s; j++) {
|
||||
if (i != j) {
|
||||
denominator = field.multiply(denominator,
|
||||
field.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse)));
|
||||
GF256.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse)));
|
||||
}
|
||||
}
|
||||
result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse),
|
||||
|
|
|
@ -24,9 +24,6 @@ package com.google.zxing.common.reedsolomon;
|
|||
*/
|
||||
public final class ReedSolomonException extends Exception {
|
||||
|
||||
public ReedSolomonException() {
|
||||
}
|
||||
|
||||
public ReedSolomonException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public abstract class AbstractOneDReader implements OneDReader {
|
|||
throw new ReaderException("No barcode found");
|
||||
}
|
||||
|
||||
protected static void recordPattern(BitArray row, int start, int[] counters) throws ReaderException {
|
||||
static void recordPattern(BitArray row, int start, int[] counters) throws ReaderException {
|
||||
int numCounters = counters.length;
|
||||
for (int i = 0; i < numCounters; i++) {
|
||||
counters[i] = 0;
|
||||
|
@ -141,7 +141,7 @@ public abstract class AbstractOneDReader implements OneDReader {
|
|||
* @param pattern expected pattern
|
||||
* @return average variance between counters and pattern
|
||||
*/
|
||||
protected static float patternMatchVariance(int[] counters, int[] pattern) {
|
||||
static float patternMatchVariance(int[] counters, int[] pattern) {
|
||||
int total = 0;
|
||||
int numCounters = counters.length;
|
||||
int patternLength = 0;
|
||||
|
@ -161,13 +161,4 @@ public abstract class AbstractOneDReader implements OneDReader {
|
|||
return totalVariance / (float) patternLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast round method.
|
||||
*
|
||||
* @return argument rounded to nearest int
|
||||
*/
|
||||
protected static int round(float f) {
|
||||
return (int) (f + 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,17 +40,17 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
/**
|
||||
* Start/end guard pattern.
|
||||
*/
|
||||
protected static final int[] START_END_PATTERN = {1, 1, 1,};
|
||||
private static final int[] START_END_PATTERN = {1, 1, 1,};
|
||||
|
||||
/**
|
||||
* Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
|
||||
*/
|
||||
protected static final int[] MIDDLE_PATTERN = {1, 1, 1, 1, 1};
|
||||
static final int[] MIDDLE_PATTERN = {1, 1, 1, 1, 1};
|
||||
|
||||
/**
|
||||
* "Odd", or "L" patterns used to encode UPC/EAN digits.
|
||||
*/
|
||||
protected static final int[][] L_PATTERNS = {
|
||||
static final int[][] L_PATTERNS = {
|
||||
{3, 2, 1, 1}, // 0
|
||||
{2, 2, 2, 1}, // 1
|
||||
{2, 1, 2, 2}, // 2
|
||||
|
@ -66,7 +66,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
/**
|
||||
* As above but also including the "even", or "G" patterns used to encode UPC/EAN digits.
|
||||
*/
|
||||
protected static final int[][] L_AND_G_PATTERNS;
|
||||
static final int[][] L_AND_G_PATTERNS;
|
||||
|
||||
static {
|
||||
L_AND_G_PATTERNS = new int[20][];
|
||||
|
@ -139,7 +139,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
* @return true iff string of digits passes the UPC/EAN checksum algorithm
|
||||
* @throws ReaderException if the string does not contain only digits
|
||||
*/
|
||||
protected boolean checkChecksum(String s) throws ReaderException {
|
||||
boolean checkChecksum(String s) throws ReaderException {
|
||||
int sum = 0;
|
||||
int length = s.length();
|
||||
for (int i = length - 2; i >= 0; i -= 2) {
|
||||
|
@ -172,7 +172,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
protected abstract int decodeMiddle(BitArray row, int[] startRange, StringBuffer resultString)
|
||||
throws ReaderException;
|
||||
|
||||
protected int[] decodeEnd(BitArray row, int endStart) throws ReaderException {
|
||||
int[] decodeEnd(BitArray row, int endStart) throws ReaderException {
|
||||
return findGuardPattern(row, endStart, false, START_END_PATTERN);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
* @return start/end horizontal offset of guard pattern, as an array of two ints
|
||||
* @throws ReaderException if pattern is not found
|
||||
*/
|
||||
protected static int[] findGuardPattern(BitArray row, int rowOffset, boolean whiteFirst, int[] pattern)
|
||||
static int[] findGuardPattern(BitArray row, int rowOffset, boolean whiteFirst, int[] pattern)
|
||||
throws ReaderException {
|
||||
int patternLength = pattern.length;
|
||||
int[] counters = new int[patternLength];
|
||||
|
@ -240,7 +240,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
* @return horizontal offset of first pixel beyond the decoded digit
|
||||
* @throws ReaderException if digit cannot be decoded
|
||||
*/
|
||||
protected static int decodeDigit(BitArray row,
|
||||
static int decodeDigit(BitArray row,
|
||||
int[] counters,
|
||||
int rowOffset,
|
||||
int[][] patterns) throws ReaderException {
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.zxing.common.BitArray;
|
|||
public interface UPCEANReader extends OneDReader {
|
||||
|
||||
/**
|
||||
* <p>Like {@link #decodeRow(int, com.google.zxing.common.BitArray)}, but
|
||||
* <p>Like {@link #decodeRow(int, BitArray, java.util.Hashtable)}, but
|
||||
* allows caller to inform method about where the UPC/EAN start pattern is
|
||||
* found. This allows this to be computed once and reused across many implementations.</p>
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@ final class Mode {
|
|||
static final Mode BYTE = new Mode(new int[]{8, 16, 16});
|
||||
static final Mode KANJI = new Mode(new int[]{8, 10, 12});
|
||||
|
||||
private int[] characterCountBitsForVersions;
|
||||
private final int[] characterCountBitsForVersions;
|
||||
|
||||
private Mode(int[] characterCountBitsForVersions) {
|
||||
this.characterCountBitsForVersions = characterCountBitsForVersions;
|
||||
|
|
|
@ -181,8 +181,8 @@ public final class Version {
|
|||
* will be the same across all blocks within one version.</p>
|
||||
*/
|
||||
static final class ECBlocks {
|
||||
private int ecCodewords;
|
||||
private ECB[] ecBlocks;
|
||||
private final int ecCodewords;
|
||||
private final ECB[] ecBlocks;
|
||||
|
||||
private ECBlocks(int ecCodewords, ECB ecBlocks) {
|
||||
this.ecCodewords = ecCodewords;
|
||||
|
@ -209,8 +209,8 @@ public final class Version {
|
|||
* parameters is used consecutively in the QR code version's format.</p>
|
||||
*/
|
||||
static final class ECB {
|
||||
private int count;
|
||||
private int dataCodewords;
|
||||
private final int count;
|
||||
private final int dataCodewords;
|
||||
|
||||
private ECB(int count, int dataCodewords) {
|
||||
this.count = count;
|
||||
|
|
|
@ -44,10 +44,6 @@ public final class AlignmentPattern implements ResultPoint {
|
|||
return posY;
|
||||
}
|
||||
|
||||
float getEstimatedModuleSize() {
|
||||
return estimatedModuleSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Determines if this alignment pattern "about equals" an alignment pattern at the stated
|
||||
* position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
|
||||
|
|
|
@ -94,7 +94,6 @@ final class AlignmentPatternFinder {
|
|||
stateCount[0] = 0;
|
||||
stateCount[1] = 0;
|
||||
stateCount[2] = 0;
|
||||
int currentState = 0;
|
||||
int j = startX;
|
||||
// Burn off leading white pixels before anything else; if we start in the middle of
|
||||
// a white run, it doesn't make sense to count its length, since we don't know if the
|
||||
|
@ -102,6 +101,7 @@ final class AlignmentPatternFinder {
|
|||
while (j < maxJ && !luminanceRow.get(j - startX)) {
|
||||
j++;
|
||||
}
|
||||
int currentState = 0;
|
||||
while (j < maxJ) {
|
||||
if (luminanceRow.get(j - startX)) {
|
||||
// Black pixel
|
||||
|
|
|
@ -146,12 +146,8 @@ final class FinderPatternFinder {
|
|||
|
||||
FinderPattern[] patternInfo = selectBestPatterns();
|
||||
patternInfo = orderBestPatterns(patternInfo);
|
||||
float totalModuleSize = 0.0f;
|
||||
for (int i = 0; i < patternInfo.length; i++) {
|
||||
totalModuleSize += patternInfo[i].getEstimatedModuleSize();
|
||||
}
|
||||
|
||||
return new FinderPatternInfo(totalModuleSize / (float) patternInfo.length, patternInfo);
|
||||
return new FinderPatternInfo(patternInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,23 +24,16 @@ package com.google.zxing.qrcode.detector;
|
|||
*/
|
||||
final class FinderPatternInfo {
|
||||
|
||||
private final float rawEstimatedModuleSize;
|
||||
private final FinderPattern bottomLeft;
|
||||
private final FinderPattern topLeft;
|
||||
private final FinderPattern topRight;
|
||||
|
||||
FinderPatternInfo(float rawEstimatedModuleSize,
|
||||
FinderPattern[] patternCenters) {
|
||||
this.rawEstimatedModuleSize = rawEstimatedModuleSize;
|
||||
FinderPatternInfo(FinderPattern[] patternCenters) {
|
||||
this.bottomLeft = patternCenters[0];
|
||||
this.topLeft = patternCenters[1];
|
||||
this.topRight = patternCenters[2];
|
||||
}
|
||||
|
||||
float getRawEstimatedModuleSize() {
|
||||
return rawEstimatedModuleSize;
|
||||
}
|
||||
|
||||
FinderPattern getBottomLeft() {
|
||||
return bottomLeft;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ final class PerspectiveTransform {
|
|||
|
||||
PerspectiveTransform qToS = quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);
|
||||
PerspectiveTransform sToQ = squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
|
||||
PerspectiveTransform product = sToQ.times(qToS);
|
||||
return product;
|
||||
return sToQ.times(qToS);
|
||||
}
|
||||
|
||||
void transformPoints(float[] points) {
|
||||
|
@ -100,10 +99,10 @@ final class PerspectiveTransform {
|
|||
}
|
||||
}
|
||||
|
||||
static PerspectiveTransform quadrilateralToSquare(float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
float x3, float y3) {
|
||||
private static PerspectiveTransform quadrilateralToSquare(float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
float x3, float y3) {
|
||||
// Here, the adjoint serves as the inverse:
|
||||
return squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ final class AdvancedMultimediaManager {
|
|||
|
||||
// These signatures must match those in the other class exactly
|
||||
|
||||
static void setFocus(Controllable player) throws MediaException, InterruptedException {
|
||||
static void setFocus(Controllable player) throws MediaException {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ final class AdvancedMultimediaManager {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
static void setFocus(Controllable player) throws MediaException, InterruptedException {
|
||||
static void setFocus(Controllable player) throws MediaException {
|
||||
FocusControl focusControl = (FocusControl)
|
||||
player.getControl("javax.microedition.amms.control.camera.FocusControl");
|
||||
if (focusControl != null) {
|
||||
|
@ -52,7 +52,11 @@ final class AdvancedMultimediaManager {
|
|||
}
|
||||
if (focusControl.isAutoFocusSupported()) {
|
||||
focusControl.setFocus(FocusControl.AUTO);
|
||||
Thread.sleep(FOCUS_TIME_MS); // let it focus...
|
||||
try {
|
||||
Thread.sleep(FOCUS_TIME_MS); // let it focus...
|
||||
} catch (InterruptedException ie) {
|
||||
// continue
|
||||
}
|
||||
try {
|
||||
focusControl.setFocus(FocusControl.AUTO_LOCK);
|
||||
} catch (MediaException me) {
|
||||
|
|
|
@ -36,7 +36,7 @@ final class SnapshotThread extends Thread {
|
|||
|
||||
private final ZXingMIDlet zXingMIDlet;
|
||||
|
||||
SnapshotThread(ZXingMIDlet zXingMIDlet) {
|
||||
private SnapshotThread(ZXingMIDlet zXingMIDlet) {
|
||||
this.zXingMIDlet = zXingMIDlet;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,10 @@ final class SnapshotThread extends Thread {
|
|||
} catch (ReaderException re) {
|
||||
// Show a friendlier message on a mere failure to read the barcode
|
||||
zXingMIDlet.showError("Sorry, no barcode was found.");
|
||||
} catch (Throwable t) {
|
||||
zXingMIDlet.showError(t);
|
||||
} catch (MediaException me) {
|
||||
zXingMIDlet.showError(me);
|
||||
} catch (RuntimeException re) {
|
||||
zXingMIDlet.showError(re);
|
||||
} finally {
|
||||
try {
|
||||
player.start();
|
||||
|
|
|
@ -52,6 +52,10 @@ public final class ZXingMIDlet extends MIDlet {
|
|||
private Player player;
|
||||
private VideoControl videoControl;
|
||||
|
||||
Canvas getCanvas() {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
@ -152,7 +156,7 @@ public final class ZXingMIDlet extends MIDlet {
|
|||
}
|
||||
} else {
|
||||
// cancel
|
||||
Display.getDisplay(ZXingMIDlet.this).setCurrent(canvas);
|
||||
Display.getDisplay(ZXingMIDlet.this).setCurrent(getCanvas());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@ package com.google.zxing.client.j2se;
|
|||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.MonochromeBitmapSource;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
@ -64,9 +65,9 @@ public final class CommandLineRunner {
|
|||
return false;
|
||||
}
|
||||
try {
|
||||
Hashtable hints = new Hashtable();
|
||||
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(3);
|
||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||
BufferedImageMonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource(image);
|
||||
MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource(image);
|
||||
String result = new MultiFormatReader().decode(source, hints).getText();
|
||||
System.out.println(uri.toString() + ": " + result);
|
||||
return true;
|
||||
|
|
|
@ -46,7 +46,6 @@ public final class ImageConverter {
|
|||
File inputFile = new File(arg);
|
||||
if (inputFile.exists()) {
|
||||
if (inputFile.isDirectory()) {
|
||||
int count = 0;
|
||||
for (File input : inputFile.listFiles()) {
|
||||
convertImage(input.toURI());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue