本文整理汇总了Java中com.google.zxing.NotFoundException.getNotFoundInstance方法的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException.getNotFoundInstance方法的具体用法?Java NotFoundException.getNotFoundInstance怎么用?Java NotFoundException.getNotFoundInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.NotFoundException
的用法示例。
在下文中一共展示了NotFoundException.getNotFoundInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recordPatternInReverse
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
protected static void recordPatternInReverse(BitArray row, int start, int[] counters) throws
NotFoundException {
int numTransitionsLeft = counters.length;
boolean last = row.get(start);
while (start > 0 && numTransitionsLeft >= 0) {
start--;
if (row.get(start) != last) {
numTransitionsLeft--;
last = !last;
}
}
if (numTransitionsLeft >= 0) {
throw NotFoundException.getNotFoundInstance();
}
recordPattern(row, start + 1, counters);
}
示例2: detectMulti
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
BitMatrix image = getImage();
ResultPointCallback resultPointCallback =
hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
FinderPatternInfo[] infos = finder.findMulti(hints);
if (infos.length == 0) {
throw NotFoundException.getNotFoundInstance();
}
List<DetectorResult> result = new ArrayList<>();
for (FinderPatternInfo info : infos) {
try {
result.add(processFinderPatternInfo(info));
} catch (ReaderException e) {
// ignore
}
}
if (result.isEmpty()) {
return EMPTY_DETECTOR_RESULTS;
} else {
return result.toArray(new DetectorResult[result.size()]);
}
}
示例3: recordPatternInReverse
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
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);
}
示例4: findStartPattern
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
private int findStartPattern() throws NotFoundException {
for (int i = 1; i < counterLength; i += 2) {
int charOffset = toNarrowWidePattern(i);
if (charOffset != -1 && arrayContains(STARTEND_ENCODING, ALPHABET[charOffset])) {
// Look for whitespace before start pattern, >= 50% of width of start pattern
// We make an exception if the whitespace is the first element.
int patternSize = 0;
for (int j = i; j < i + 7; j++) {
patternSize += counters[j];
}
if (i == 1 || counters[i-1] >= patternSize / 2) {
return i;
}
}
}
throw NotFoundException.getNotFoundInstance();
}
示例5: computeDimension
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
/**
* <p>Computes the dimension (number of modules on a size) of the QR Code based on the position
* of the finder patterns and estimated module size.</p>
*/
private static int computeDimension(ResultPoint topLeft,
ResultPoint topRight,
ResultPoint bottomLeft,
float moduleSize) throws NotFoundException {
int tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);
int tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
int dimension = ((tltrCentersDimension + tlblCentersDimension) / 2) + 7;
switch (dimension & 0x03) { // mod 4
case 0:
dimension++;
break;
// 1? do nothing
case 2:
dimension--;
break;
case 3:
throw NotFoundException.getNotFoundInstance();
}
return dimension;
}
示例6: decodeDigit
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
/**
* Attempts to decode a sequence of ITF black/white lines into single
* digit.
*
* @param counters the counts of runs of observed black/white/black/... values
* @return The decoded digit
* @throws NotFoundException if digit cannot be decoded
*/
private static int decodeDigit(int[] counters) throws NotFoundException {
float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
int bestMatch = -1;
int max = PATTERNS.length;
for (int i = 0; i < max; i++) {
int[] pattern = PATTERNS[i];
float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = i;
}
}
if (bestMatch >= 0) {
return bestMatch;
} else {
throw NotFoundException.getNotFoundInstance();
}
}
示例7: determineCheckDigit
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
private static int determineCheckDigit(int lgPatternFound)
throws NotFoundException {
for (int d = 0; d < 10; d++) {
if (lgPatternFound == CHECK_DIGIT_ENCODINGS[d]) {
return d;
}
}
throw NotFoundException.getNotFoundInstance();
}
示例8: parseInformation
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
public String parseInformation() throws NotFoundException {
if (getInformation().getSize() != 84) {
throw NotFoundException.getNotFoundInstance();
}
StringBuilder buf = new StringBuilder();
encodeCompressedGtin(buf, 8);
encodeCompressedWeight(buf, 48, 20);
encodeCompressedDate(buf, 68);
return buf.toString();
}
示例9: BoundingBox
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
BoundingBox(BitMatrix image, ResultPoint topLeft, ResultPoint bottomLeft, ResultPoint
topRight, ResultPoint bottomRight) throws NotFoundException {
if (!(topLeft == null && topRight == null) && (!(bottomLeft == null && bottomRight ==
null) && ((topLeft == null || bottomLeft != null) && (topRight == null ||
bottomRight != null)))) {
init(image, topLeft, bottomLeft, topRight, bottomRight);
return;
}
throw NotFoundException.getNotFoundInstance();
}
示例10: patternToChar
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
private static char patternToChar(int pattern) throws NotFoundException {
for (int i = 0; i < CHARACTER_ENCODINGS.length; i++) {
if (CHARACTER_ENCODINGS[i] == pattern) {
return ALPHABET[i];
}
}
throw NotFoundException.getNotFoundInstance();
}
示例11: patternToChar
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
private static char patternToChar(int pattern) throws NotFoundException {
for (int i = 0; i < CHARACTER_ENCODINGS.length; i++) {
if (CHARACTER_ENCODINGS[i] == pattern) {
return ALPHABET_STRING.charAt(i);
}
}
throw NotFoundException.getNotFoundInstance();
}
示例12: parseInformation
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
@Override
public String parseInformation() throws NotFoundException {
if (this.getInformation().getSize() != HEADER_SIZE + GTIN_SIZE + WEIGHT_SIZE) {
throw NotFoundException.getNotFoundInstance();
}
StringBuilder buf = new StringBuilder();
encodeCompressedGtin(buf, HEADER_SIZE);
encodeCompressedWeight(buf, HEADER_SIZE + GTIN_SIZE, WEIGHT_SIZE);
return buf.toString();
}
示例13: decodeRow
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
@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();
}
示例14: decodeRow2pairs
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException {
while (true) {
try {
this.pairs.add(retrieveNextPair(row, this.pairs, rowNumber));
} catch (NotFoundException nfe) {
if (this.pairs.isEmpty()) {
throw nfe;
} else if (checkChecksum()) {
return this.pairs;
} else {
boolean tryStackedDecode;
if (this.rows.isEmpty()) {
tryStackedDecode = false;
} else {
tryStackedDecode = true;
}
storeRow(rowNumber, false);
if (tryStackedDecode) {
List<ExpandedPair> ps = checkRows(false);
if (ps != null) {
return ps;
}
ps = checkRows(true);
if (ps != null) {
return ps;
}
}
throw NotFoundException.getNotFoundInstance();
}
}
}
}
示例15: findAsteriskPattern
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
private static int[] findAsteriskPattern(BitArray row, int[] counters) throws NotFoundException {
int width = row.getSize();
int rowOffset = row.getNextSet(0);
int counterPosition = 0;
int patternStart = rowOffset;
boolean isWhite = false;
int patternLength = counters.length;
for (int i = rowOffset; i < width; i++) {
if (row.get(i) ^ isWhite) {
counters[counterPosition]++;
} else {
if (counterPosition == patternLength - 1) {
// Look for whitespace before start pattern, >= 50% of width of start pattern
if (toNarrowWidePattern(counters) == ASTERISK_ENCODING &&
row.isRange(Math.max(0, patternStart - ((i - patternStart) / 2)), patternStart, false)) {
return new int[]{patternStart, i};
}
patternStart += counters[0] + counters[1];
System.arraycopy(counters, 2, counters, 0, patternLength - 2);
counters[patternLength - 2] = 0;
counters[patternLength - 1] = 0;
counterPosition--;
} else {
counterPosition++;
}
counters[counterPosition] = 1;
isWhite = !isWhite;
}
}
throw NotFoundException.getNotFoundInstance();
}