想做一个网站根据提交图片识别解析二维码,想从内存流中读取图片信息,求zxing内存流接
时间: 2016-08-22来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>> 因为这个接口是文件路径,但是做网站不能这样读取,想直接从内存流中读取,求教大神应该这么做?~~~public void testDecode() { String filePath = "k://zxing.png"; BufferedImage image; try { image = ImageIO.read(new File(filePath)); LuminanceSource source = new BufferedImageLuminanceSource(image); Binarizer binarizer = new HybridBinarizer(source); BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>(); hints.put(DecodeHintType.CHARACTER_SET, "UTF-8"); Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码 JSONObject content = JSONObject.fromObject(result.getText()); System.out.println("图片中内容: "); System.out.println("author: " + content.getString("author")); System.out.println("zxing: " + content.getString("zxing")); System.out.println("图片中格式: "); System.out.println("encode: " + result.getBarcodeFormat()); } catch (IOException e) { e.printStackTrace(); } catch (NotFoundException e) { e.printStackTrace(); } }

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行