本文整理汇总了Java中com.google.zxing.NotFoundException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException.printStackTrace方法的具体用法?Java NotFoundException.printStackTrace怎么用?Java NotFoundException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.NotFoundException
的用法示例。
在下文中一共展示了NotFoundException.printStackTrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRawResult
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
/**
* 获取解码结果
*
* @param bitmap
* @return
*/
public Result getRawResult(Bitmap bitmap) {
if (bitmap == null) {
return null;
}
try {
return multiFormatReader.decodeWithState(new BinaryBitmap(
new HybridBinarizer(new BitmapLuminanceSource(bitmap))));
}
catch (NotFoundException e) {
e.printStackTrace();
}
return null;
}
示例2: decodeImage
import com.google.zxing.NotFoundException; //导入方法依赖的package包/类
public static Result decodeImage(final String path) {
Bitmap bitmap = QrUtils.decodeSampledBitmapFromFile(path, 256, 256);
// Google Photo 相册中选取云照片是会出现 Bitmap == null
if (bitmap == null) return null;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
// RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);
PlanarYUVLuminanceSource source1 = new PlanarYUVLuminanceSource(getYUV420sp(width, height, bitmap), width, height, 0, 0, width, height, false);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source1));
// BinaryBitmap binaryBitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source1));
HashMap<DecodeHintType, Object> hints = new HashMap<>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
try {
return new MultiFormatReader().decode(binaryBitmap, hints);
} catch (NotFoundException e) {
e.printStackTrace();
}
return null;
}