@Override public Result decode(BinaryBitmap image) throws NotFoundException, FormatException { return decode(image, null); }
@Override public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints) throws NotFoundException { for (OneDReader reader : readers) { try { return reader.decodeRow(rowNumber, row, hints); } catch (ReaderException re) { // continue } } throw NotFoundException.getNotFoundInstance(); }
protected static void recordPatternInReverse(BitArray row, int start, int[] counters) throws NotFoundException { // This could be more efficient I guess int numTransitionsLeft = counters.length; boolean last = row.get(start); while (start > 0 && numTransitionsLeft >= 0) { if (row.get(--start) != last) { numTransitionsLeft--; last = !last; } } if (numTransitionsLeft >= 0) { throw NotFoundException.getNotFoundInstance(); } recordPattern(row, start + 1, counters); }
public Result decode(BinaryBitmap image, Hashtable hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER); if (tryHarder && image.isRotateSupported()) { BinaryBitmap rotatedImage = image.rotateCounterClockwise(); Result result = doDecode(rotatedImage, hints); // Record that we found it rotated 90 degrees CCW / 270 degrees CW Hashtable metadata = result.getResultMetadata(); int orientation = 270; if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) { // But if we found it reversed in doDecode(), add in that result here: orientation = (orientation + ((Integer) metadata.get(ResultMetadataType.ORIENTATION)).intValue()) % 360; } result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(orientation)); // Update result points ResultPoint[] points = result.getResultPoints(); int height = rotatedImage.getHeight(); for (int i = 0; i < points.length; i++) { points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX()); } return result; } else { throw nfe; } } }
protected static void recordPatternInReverse(BitArray row, int start, int[] counters) throws NotFoundException { // This could be more efficient I guess int numTransitionsLeft = counters.length; boolean last = row.get(start); while (start > 0 && numTransitionsLeft >= 0) { if (row.get(--start) != last) { numTransitionsLeft--; last = !last; } } if (numTransitionsLeft >= 0) { throw NotFoundException.getNotFoundInstance(); } recordPattern(row, start + 1, counters); }
Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER); if (tryHarder && image.isRotateSupported()) { BinaryBitmap rotatedImage = image.rotateCounterClockwise(); Result result = doDecode(rotatedImage, hints);
@Override public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints) throws NotFoundException { for (OneDReader reader : readers) { try { return reader.decodeRow(rowNumber, row, hints); } catch (ReaderException re) { // continue } } throw NotFoundException.getNotFoundInstance(); }
@Override public Result decode(BinaryBitmap image) throws NotFoundException, FormatException { return decode(image, null); }
protected static void recordPatternInReverse(BitArray row, int start, int[] counters) throws NotFoundException { // This could be more efficient I guess int numTransitionsLeft = counters.length; boolean last = row.get(start); while (start > 0 && numTransitionsLeft >= 0) { if (row.get(--start) != last) { numTransitionsLeft--; last = !last; } } if (numTransitionsLeft >= 0) { throw NotFoundException.getNotFoundInstance(); } recordPattern(row, start + 1, counters); }
Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER); if (tryHarder && image.isRotateSupported()) { BinaryBitmap rotatedImage = image.rotateCounterClockwise(); Result result = doDecode(rotatedImage, hints);
public Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws NotFoundException { int size = readers.size(); for (int i = 0; i < size; i++) { OneDReader reader = (OneDReader) readers.elementAt(i); try { return reader.decodeRow(rowNumber, row, hints); } catch (ReaderException re) { // continue } } throw NotFoundException.getNotFoundInstance(); }
public Result decode(BinaryBitmap image) throws NotFoundException, FormatException { return decode(image, null); }
Result result = decodeRow(rowNumber, row, hints);
Result result = decodeRow(rowNumber, row, hints);
Result result = decodeRow(rowNumber, row, hints);