示例#1
0
 private static String decodeQrcode(String filePath) {
   String content = "";
   try {
     BufferedImage image = ImageIO.read(new File(filePath));
     MultiFormatReader reader = new MultiFormatReader();
     LuminanceSource source = new BufferedImageLuminanceSource(image);
     BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
     Result result = reader.decode(bitmap, getDecodeHints());
     content = result.getText();
   } catch (Exception e) {
     e.printStackTrace();
   }
   return content;
 }