二维码解析
二維碼解析
前幾天說了二維碼的生成,今天說下二維碼的解析
public static void main(String[] args) throws NotFoundException, IOException {File file = new File("你的二維碼路徑", "二維碼名稱");//定義二維碼的參數HashMap hints = new HashMap();hints.put(EncodeHintType.CHARACTER_SET, "utf-8");//L級:約可糾錯7%的數據碼字,M級:約可糾錯15%的數據碼字,Q級:約可糾錯25%的數據碼字,H級:約可糾錯30%的數據碼字hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.Q);hints.put(EncodeHintType.MARGIN, 2);MultiFormatReader formatReader = new MultiFormatReader();BufferedImage image = ImageIO.read(file);BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(image)));Result result = formatReader.decode(binaryBitmap, hints); }總結
- 上一篇: java泡泡屏保,js 模拟气泡屏保效果
- 下一篇: 1582年日历怎么了_1582年从10月