//二维码识别函数 public static String QrCode() { Result result = null; //作用:存放图片数据 QR_Recognition rSource = new QR_Recognition( LeftFragment.bitmap); //对图片数据进行二值化 try { BinaryBitmap binaryBitmap = new BinaryBitmap( new HybridBinarizer(rSource)); //对二维码数据指定一个编码格式 Map<DecodeHintType, String> hint = new HashMap<DecodeHintType, String>(); hint.put(DecodeHintType.CHARACTER_SET, "utf-8"); //谷歌提供的jar包中的识别类 QRCodeReader reader = new QRCodeReader(); result = reader.decode(binaryBitmap, hint); } catch (FormatException e) { e.printStackTrace(); } catch (ChecksumException e) { e.printStackTrace(); } catch (NotFoundException e) { e.printStackTrace(); } return result.toString(); }
Android OpenCV 二维码识别
最新推荐文章于 2024-03-24 13:53:09 发布