首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >扫描印度Aadhaar卡中存在的二维码的问题

扫描印度Aadhaar卡中存在的二维码的问题
EN

Stack Overflow用户
提问于 2018-08-21 18:20:26
回答 2查看 1.2K关注 0票数 3

我正在尝试解码二维码存在于印度Aadhar卡使用Zxing API为客户上传到我们的网站上的aadhar图像。

我能够解码二维码,如果它很大,并获得完整的XML数据。然而,尺寸较小的QR码不会被解码为QR码。他们被解码为BarcodeFormat.UPC_E,这是一个一维条形码,而QR码不是二维的。因此,小二维码的输出类似于04400621,而不是预期的XML输出。在线工具https://zxing.org/w/decode.jspx也是如此。

如果我们只裁剪aadhar的二维码部分,一些小的二维码将被在线工具解码,但如果我们通过小图像的裁剪部分,API将无法解码。

我在com.google.zxing.MultiFormatReader类中使用下面的API

结果解码(BinaryBitmap图像,映射提示)

将断点放在MultiFormatReader库中,我可以看到QRCodeReader无法解码二维码,但MultiFormatOneDReader可以解码相同的二维码。

因此,这些小的二维码似乎被解码成了BarcodeFormat.UPC_E。

粘贴下面的代码片段:

代码语言:javascript
复制
   String filePath = "xyz";
   File file = new File(filePath);
   FileInputStream fileInputStream = new FileInputStream(filePath);
   BufferedImage bufferedImage = ImageIO.read(fileInputStream);

   LuminanceSource bufferedImageLuminanceSource = new BufferedImageLuminanceSource(bufferedImage);
   BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(bufferedImageLuminanceSource));

   Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(
           DecodeHintType.class);
   tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
   tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS,
           EnumSet.allOf(BarcodeFormat.class));
   tmpHintsMap.put(DecodeHintType.CHARACTER_SET, "ISO-8859-1");
   tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);(tried with and without this option)

   Result result = new MultiFormatReader().decode(binaryBitmap, tmpHintsMap);
EN

回答 2

Stack Overflow用户

发布于 2019-11-26 13:50:51

Aadhaar使用安全的二维码,出于安全原因,二维码是加密的。Link for more details

现在我们可以使用UIDAI’s windows based application读取安全的二维码。

票数 1
EN

Stack Overflow用户

发布于 2019-03-02 15:31:19

尝试使用zbar库(Link here它在较大的二维码上工作得很好

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51946533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档