本文整理汇总了Java中com.google.zxing.pdf417.PDF417Common.getCodeword方法的典型用法代码示例。如果您正苦于以下问题:Java PDF417Common.getCodeword方法的具体用法?Java PDF417Common.getCodeword怎么用?Java PDF417Common.getCodeword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.pdf417.PDF417Common
的用法示例。
在下文中一共展示了PDF417Common.getCodeword方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image, int minColumn, int maxColumn, boolean
leftToRight, int startColumn, int imageRow, int minCodewordWidth, int
maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight,
startColumn, imageRow);
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight,
startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = PDF417Common.getBitCountSum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length / 2; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[(moduleBitCount.length - 1) - i];
moduleBitCount[(moduleBitCount.length - 1) - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue),
codeword);
}
示例2: getDecodedCodewordValue
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static int getDecodedCodewordValue(int[] moduleBitCount) {
int decodedValue = getBitValue(moduleBitCount);
return PDF417Common.getCodeword(decodedValue) == -1 ? -1 : decodedValue;
}
示例3: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = PDF417Common.getBitCountSum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length / 2; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if blackbars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
示例4: getDecodedCodewordValue
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static int getDecodedCodewordValue(int[] moduleBitCount) {
int decodedValue = getBitValue(moduleBitCount);
return PDF417Common.getCodeword(decodedValue) == -1 ? -1 : decodedValue;
}
示例5: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = MathUtils.sum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length / 2; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if blackbars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
示例6: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = PDF417Common.getBitCountSum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length / 2; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if blackbars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
示例7: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = PDF417Common.getBitCountSum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length >> 1; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if blackbars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
示例8: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = MathUtils.sum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length / 2; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if black bars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
示例9: detectCodeword
import com.google.zxing.pdf417.PDF417Common; //导入方法依赖的package包/类
private static Codeword detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) {
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
// we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
// and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
// min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
// for the current position
int[] moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == null) {
return null;
}
int endColumn;
int codewordBitCount = PDF417Common.getBitCountSum(moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
for (int i = 0; i < moduleBitCount.length >> 1; i++) {
int tmpCount = moduleBitCount[i];
moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
// TODO implement check for width and correction of black and white bars
// use start (and maybe stop pattern) to determine if blackbars are wider than white bars. If so, adjust.
// should probably done only for codewords with a lot more than 17 bits.
// The following fixes 10-1.png, which has wide black bars and small white bars
// for (int i = 0; i < moduleBitCount.length; i++) {
// if (i % 2 == 0) {
// moduleBitCount[i]--;
// } else {
// moduleBitCount[i]++;
// }
// }
// We could also use the width of surrounding codewords for more accurate results, but this seems
// sufficient for now
if (!checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
// We could try to use the startX and endX position of the codeword in the same column in the previous row,
// create the bit count from it and normalize it to 8. This would help with single pixel errors.
return null;
}
int decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);
int codeword = PDF417Common.getCodeword(decodedValue);
if (codeword == -1) {
return null;
}
return new Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}