zxing icon indicating copy to clipboard operation
zxing copied to clipboard

不支持直接传入bitmap进行识别么

Open zzzsssbo opened this issue 4 years ago • 2 comments

zzzsssbo avatar Apr 23 '20 02:04 zzzsssbo

同问

888ewe avatar Apr 29 '20 05:04 888ewe

这样: public static String decodeShareImage(Bitmap obmp) { String text = ""; int width = obmp.getWidth(); int height = obmp.getHeight(); int[] data = new int[width * height]; obmp.getPixels(data, 0, width, 0, 0, width, height); Result result = null; BinaryBitmap zbitmap = new BinaryBitmap(new HybridBinarizer(new RGBLuminanceSource(width, height, data))); QRCodeReader reader = new QRCodeReader(); try { result = reader.decode(zbitmap); ParsedResult parsedResult = ResultParser.parseResult(result); text = parsedResult.toString(); } catch (OutOfMemoryError e) { } catch (Exception e) { } return text; }

Dullyoung avatar Jul 09 '20 01:07 Dullyoung