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; } } }
int height = image.getHeight(); BitArray row = new BitArray(width);
int height = rotatedImage.getHeight(); for (int i = 0; i < points.length; i++) { points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
int height = rotatedImage.getHeight(); for (int i = 0; i < points.length; i++) { points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
Map<DecodeHintType,?> hints) throws NotFoundException { int width = image.getWidth(); int height = image.getHeight(); BitArray row = new BitArray(width);
Map<DecodeHintType,?> hints) throws NotFoundException { int width = image.getWidth(); int height = image.getHeight(); BitArray row = new BitArray(width);
int height = image.getHeight(); float minX = width; float minY = height;
int height = image.getHeight(); float minX = width; float minY = height;
int height = image.getHeight(); float minX = width; float minY = height;
int height = image.getHeight(); int halfWidth = width / 2; int halfHeight = height / 2;
int height = image.getHeight(); int halfWidth = width / 2; int halfHeight = height / 2;
int height = image.getHeight(); int halfWidth = width / 2; int halfHeight = height / 2;