}
image.getBlackRow(rowNumber, row, 0, width);
- // We may try twice for each row, if "trying harder":
+ // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
+ // handle decoding upside down barcodes.
for (int attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) { // trying again?
- if (tryHarder) { // only if "trying harder"
- row.reverse(); // reverse the row and continue
- } else {
- break;
- }
+ row.reverse(); // reverse the row and continue
}
try {
// Look for a barcode
* @param counters array into which to record counts
* @throws ReaderException if counters cannot be filled entirely from row before running out of pixels
*/
- public 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;
* @param pattern expected pattern
* @return average variance between counters and pattern
*/
- public static float patternMatchVariance(int[] counters, int[] pattern) {
+ static float patternMatchVariance(int[] counters, int[] pattern) {
int total = 0;
int numCounters = counters.length;
int patternLength = 0;
return totalVariance / (float) patternLength;
}
+ // This declaration should not be necessary, since this class is
+ // abstract and so does not have to provide an implementation for every
+ // method of an interface it implements, but it is causing NoSuchMethodError
+ // issues on some Nokia JVMs. So we add this superfluous declaration:
+
+ public abstract Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws ReaderException;
+
}