react-native-nitro-zxing 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/VisionCameraZxing.podspec +48 -0
- package/android/CMakeLists.txt +43 -0
- package/android/build.gradle +150 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/margelo/nitro/camera/zxing/VisionCameraZxingPackage.kt +21 -0
- package/cpp/BarcodeValueTypeClassifier.cpp +70 -0
- package/cpp/BarcodeValueTypeClassifier.hpp +14 -0
- package/cpp/FrameImageView.cpp +75 -0
- package/cpp/FrameImageView.hpp +34 -0
- package/cpp/HybridBarcode.cpp +59 -0
- package/cpp/HybridBarcode.hpp +26 -0
- package/cpp/HybridBarcodeScanner.cpp +121 -0
- package/cpp/HybridBarcodeScanner.hpp +26 -0
- package/cpp/HybridBarcodeScannerFactory.cpp +11 -0
- package/cpp/HybridBarcodeScannerFactory.hpp +14 -0
- package/cpp/ImageDownscaler.cpp +34 -0
- package/cpp/ImageDownscaler.hpp +21 -0
- package/cpp/ZXingDecoder.cpp +189 -0
- package/cpp/ZXingDecoder.hpp +72 -0
- package/cpp/zxing-core/LICENSE +202 -0
- package/cpp/zxing-core/README.md +156 -0
- package/cpp/zxing-core/core/CMakeLists.txt +784 -0
- package/cpp/zxing-core/core/Version.h.in +28 -0
- package/cpp/zxing-core/core/ZXingConfig.cmake.in +9 -0
- package/cpp/zxing-core/core/src/Barcode.cpp +255 -0
- package/cpp/zxing-core/core/src/Barcode.h +191 -0
- package/cpp/zxing-core/core/src/BarcodeData.h +100 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.cpp +286 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.h +272 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.cpp +111 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.h +66 -0
- package/cpp/zxing-core/core/src/BitArray.cpp +38 -0
- package/cpp/zxing-core/core/src/BitArray.h +181 -0
- package/cpp/zxing-core/core/src/BitMatrix.cpp +175 -0
- package/cpp/zxing-core/core/src/BitMatrix.h +199 -0
- package/cpp/zxing-core/core/src/BitMatrixCursor.h +253 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.cpp +101 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.h +21 -0
- package/cpp/zxing-core/core/src/BitSource.cpp +77 -0
- package/cpp/zxing-core/core/src/BitSource.h +72 -0
- package/cpp/zxing-core/core/src/ByteArray.h +42 -0
- package/cpp/zxing-core/core/src/CharacterSet.cpp +78 -0
- package/cpp/zxing-core/core/src/CharacterSet.h +58 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.cpp +312 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.h +156 -0
- package/cpp/zxing-core/core/src/Content.cpp +471 -0
- package/cpp/zxing-core/core/src/Content.h +82 -0
- package/cpp/zxing-core/core/src/ContentType.h +19 -0
- package/cpp/zxing-core/core/src/CreateBarcode.cpp +490 -0
- package/cpp/zxing-core/core/src/CreateBarcode.h +132 -0
- package/cpp/zxing-core/core/src/DecoderResult.h +92 -0
- package/cpp/zxing-core/core/src/DetectorResult.h +44 -0
- package/cpp/zxing-core/core/src/ECI.cpp +81 -0
- package/cpp/zxing-core/core/src/ECI.h +78 -0
- package/cpp/zxing-core/core/src/Error.cpp +29 -0
- package/cpp/zxing-core/core/src/Error.h +79 -0
- package/cpp/zxing-core/core/src/Flags.h +165 -0
- package/cpp/zxing-core/core/src/GTIN.cpp +253 -0
- package/cpp/zxing-core/core/src/GTIN.h +58 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.cpp +197 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.h +34 -0
- package/cpp/zxing-core/core/src/GridSampler.cpp +124 -0
- package/cpp/zxing-core/core/src/GridSampler.h +59 -0
- package/cpp/zxing-core/core/src/HRI.cpp +343 -0
- package/cpp/zxing-core/core/src/HRI.h +16 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.cpp +315 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.h +40 -0
- package/cpp/zxing-core/core/src/ImageView.h +168 -0
- package/cpp/zxing-core/core/src/JSON.cpp +154 -0
- package/cpp/zxing-core/core/src/JSON.h +66 -0
- package/cpp/zxing-core/core/src/LocalGrid.cpp +242 -0
- package/cpp/zxing-core/core/src/LocalGrid.h +91 -0
- package/cpp/zxing-core/core/src/LogMatrix.h +105 -0
- package/cpp/zxing-core/core/src/Matrix.h +125 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.cpp +107 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.h +34 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.cpp +111 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.h +62 -0
- package/cpp/zxing-core/core/src/Pattern.h +472 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.cpp +81 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.h +47 -0
- package/cpp/zxing-core/core/src/Point.h +185 -0
- package/cpp/zxing-core/core/src/Quadrilateral.h +215 -0
- package/cpp/zxing-core/core/src/Range.h +112 -0
- package/cpp/zxing-core/core/src/ReadBarcode.cpp +335 -0
- package/cpp/zxing-core/core/src/ReadBarcode.h +33 -0
- package/cpp/zxing-core/core/src/Reader.h +32 -0
- package/cpp/zxing-core/core/src/ReaderOptions.h +210 -0
- package/cpp/zxing-core/core/src/ReedSolomon.cpp +100 -0
- package/cpp/zxing-core/core/src/ReedSolomon.h +66 -0
- package/cpp/zxing-core/core/src/RegressionLine.h +161 -0
- package/cpp/zxing-core/core/src/ResultPoint.cpp +20 -0
- package/cpp/zxing-core/core/src/ResultPoint.h +35 -0
- package/cpp/zxing-core/core/src/StdGenerator.h +121 -0
- package/cpp/zxing-core/core/src/StdPrint.h +38 -0
- package/cpp/zxing-core/core/src/StdScope.h +55 -0
- package/cpp/zxing-core/core/src/StructuredAppend.h +19 -0
- package/cpp/zxing-core/core/src/SymbologyIdentifier.h +29 -0
- package/cpp/zxing-core/core/src/TextDecoder.cpp +59 -0
- package/cpp/zxing-core/core/src/TextDecoder.h +23 -0
- package/cpp/zxing-core/core/src/TextEncoder.cpp +75 -0
- package/cpp/zxing-core/core/src/TextEncoder.h +31 -0
- package/cpp/zxing-core/core/src/ThresholdBinarizer.h +58 -0
- package/cpp/zxing-core/core/src/TritMatrix.h +29 -0
- package/cpp/zxing-core/core/src/Utf.cpp +276 -0
- package/cpp/zxing-core/core/src/Utf.h +26 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.cpp +276 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.h +36 -0
- package/cpp/zxing-core/core/src/WriteBarcode.cpp +213 -0
- package/cpp/zxing-core/core/src/WriteBarcode.h +72 -0
- package/cpp/zxing-core/core/src/ZXAlgorithms.h +353 -0
- package/cpp/zxing-core/core/src/ZXConfig.h +17 -0
- package/cpp/zxing-core/core/src/ZXTestSupport.h +9 -0
- package/cpp/zxing-core/core/src/ZXVersion.h +14 -0
- package/cpp/zxing-core/core/src/ZXingC.cpp +460 -0
- package/cpp/zxing-core/core/src/ZXingC.h +296 -0
- package/cpp/zxing-core/core/src/ZXingCpp.cpp +18 -0
- package/cpp/zxing-core/core/src/ZXingCpp.h +76 -0
- package/cpp/zxing-core/core/src/ZXingQt.h +606 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.cpp +376 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.h +20 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.cpp +508 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.h +25 -0
- package/cpp/zxing-core/core/src/aztec/AZDetectorResult.h +51 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.cpp +318 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.h +44 -0
- package/cpp/zxing-core/core/src/aztec/AZEncodingState.h +40 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.cpp +377 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.h +36 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.cpp +45 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.h +21 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.cpp +44 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.h +39 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.cpp +38 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.h +55 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.cpp +194 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.cpp +63 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.h +41 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.cpp +457 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.h +19 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.cpp +1230 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.h +23 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.cpp +137 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.h +26 -0
- package/cpp/zxing-core/core/src/datamatrix/DMEncoderContext.h +128 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.cpp +919 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.h +29 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.cpp +40 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.cpp +141 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.h +78 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolShape.h +17 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.cpp +82 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.h +76 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.cpp +114 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.h +62 -0
- package/cpp/zxing-core/core/src/librscpp/README.md +65 -0
- package/cpp/zxing-core/core/src/librscpp/decode.h +258 -0
- package/cpp/zxing-core/core/src/librscpp/encode.h +124 -0
- package/cpp/zxing-core/core/src/librscpp/field.h +158 -0
- package/cpp/zxing-core/core/src/librscpp/poly.h +194 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter.c +1 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter_based.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.h +1 -0
- package/cpp/zxing-core/core/src/libzint/big5.h +1 -0
- package/cpp/zxing-core/core/src/libzint/codabar.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.h +1 -0
- package/cpp/zxing-core/core/src/libzint/common.c +1 -0
- package/cpp/zxing-core/core/src/libzint/common.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.c +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dxfilmedge.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.h +1 -0
- package/cpp/zxing-core/core/src/libzint/eci_sb.h +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.c +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/normal_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/upcean_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb18030.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb2312.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gbk.h +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.c +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.c +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1_lint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso3166.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso4217.h +1 -0
- package/cpp/zxing-core/core/src/libzint/ksx1001.h +1 -0
- package/cpp/zxing-core/core/src/libzint/large.c +1 -0
- package/cpp/zxing-core/core/src/libzint/large.h +1 -0
- package/cpp/zxing-core/core/src/libzint/library.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.h +1 -0
- package/cpp/zxing-core/core/src/libzint/medical.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.c +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417_tabs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.c +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.h +1 -0
- package/cpp/zxing-core/core/src/libzint/raster.c +1 -0
- package/cpp/zxing-core/core/src/libzint/raster_font.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.c +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol_logs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.c +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.h +1 -0
- package/cpp/zxing-core/core/src/libzint/sjis.h +1 -0
- package/cpp/zxing-core/core/src/libzint/stubs.c +137 -0
- package/cpp/zxing-core/core/src/libzint/svg.c +1 -0
- package/cpp/zxing-core/core/src/libzint/telepen.c +1 -0
- package/cpp/zxing-core/core/src/libzint/upcean.c +1 -0
- package/cpp/zxing-core/core/src/libzint/vector.c +1 -0
- package/cpp/zxing-core/core/src/libzint/zfiletypes.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zintconfig.h +1 -0
- package/cpp/zxing-core/core/src/libzueci/README.md +11 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.c +1718 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.h +179 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_big5.h +3884 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_common.h +31 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb18030.h +264 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb2312.h +2381 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gbk.h +4047 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_ksx1001.h +2932 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sb.h +1112 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sjis.h +2286 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.cpp +68 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.h +30 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.cpp +329 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.h +19 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.cpp +65 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.cpp +102 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.cpp +136 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Patterns.h +130 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.cpp +236 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.cpp +261 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.cpp +213 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.cpp +176 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Patterns.h +80 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.cpp +112 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.cpp +192 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.cpp +246 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.cpp +172 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.h +204 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.cpp +253 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.h +19 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.cpp +383 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.cpp +163 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.h +23 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.cpp +240 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.cpp +62 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.cpp +51 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.cpp +97 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.h +33 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.cpp +78 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.cpp +323 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODReader.cpp +259 -0
- package/cpp/zxing-core/core/src/oned/ODReader.h +35 -0
- package/cpp/zxing-core/core/src/oned/ODRowReader.h +222 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.cpp +199 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.cpp +33 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.cpp +80 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.h +129 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.cpp +56 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.cpp +39 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.h +48 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.cpp +796 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.h +23 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.cpp +85 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeMetadata.h +53 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.cpp +48 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.h +38 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.cpp +116 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.h +75 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodeword.h +71 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.cpp +588 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCompaction.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCustomData.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.cpp +725 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.cpp +247 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.cpp +321 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.h +83 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.cpp +371 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.h +45 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.h +182 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.cpp +333 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.h +28 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.cpp +559 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.cpp +170 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.cpp +623 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/ZXNullable.h +105 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.cpp +294 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.h +41 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.cpp +95 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.h +59 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.cpp +93 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataMask.h +50 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.cpp +359 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.h +19 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.cpp +920 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.h +45 -0
- package/cpp/zxing-core/core/src/qrcode/QRECB.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QREncodeResult.h +33 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.cpp +568 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.h +39 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.cpp +160 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.h +61 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.cpp +156 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.h +15 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.cpp +318 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.h +25 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.cpp +149 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.cpp +754 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.h +127 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.h +74 -0
- package/cpp/zxing-core/core/version.rc.in +34 -0
- package/cpp/zxing-core/core/zxing.pc.in +8 -0
- package/cpp/zxing-core/wrappers/ios/README.md +25 -0
- package/cpp/zxing-core/wrappers/ios/Sources/Wrapper/Version.h +29 -0
- package/cpp/zxing-core/zxing-cpp.podspec +45 -0
- package/lib/factory.d.ts +10 -0
- package/lib/factory.js +12 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/specs/Barcode.nitro.d.ts +63 -0
- package/lib/specs/Barcode.nitro.js +1 -0
- package/lib/specs/BarcodeFormat.d.ts +11 -0
- package/lib/specs/BarcodeFormat.js +1 -0
- package/lib/specs/BarcodeScanner.nitro.d.ts +89 -0
- package/lib/specs/BarcodeScanner.nitro.js +1 -0
- package/lib/specs/BarcodeScannerFactory.nitro.d.ts +26 -0
- package/lib/specs/BarcodeScannerFactory.nitro.js +1 -0
- package/lib/specs/BarcodeValueType.d.ts +9 -0
- package/lib/specs/BarcodeValueType.js +1 -0
- package/lib/specs/Point.d.ts +14 -0
- package/lib/specs/Point.js +1 -0
- package/lib/specs/Rect.d.ts +22 -0
- package/lib/specs/Rect.js +1 -0
- package/lib/useBarcodeScanner.d.ts +23 -0
- package/lib/useBarcodeScanner.js +25 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.cmake +83 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.gradle +27 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.cpp +49 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/zxing/VisionCameraZxingOnLoad.kt +35 -0
- package/nitrogen/generated/ios/VisionCameraZxing+autolinking.rb +62 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.mm +35 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/BarcodeFormat.hpp +124 -0
- package/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp +85 -0
- package/nitrogen/generated/shared/c++/BarcodeValueType.hpp +120 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/Point.hpp +87 -0
- package/nitrogen/generated/shared/c++/Rect.hpp +95 -0
- package/nitrogen/generated/shared/c++/TargetBarcodeFormat.hpp +124 -0
- package/package.json +108 -0
- package/react-native.config.js +16 -0
- package/src/factory.ts +26 -0
- package/src/index.ts +9 -0
- package/src/specs/Barcode.nitro.ts +70 -0
- package/src/specs/BarcodeFormat.ts +31 -0
- package/src/specs/BarcodeScanner.nitro.ts +91 -0
- package/src/specs/BarcodeScannerFactory.nitro.ts +27 -0
- package/src/specs/BarcodeValueType.ts +25 -0
- package/src/specs/Point.ts +14 -0
- package/src/specs/Rect.ts +22 -0
- package/src/useBarcodeScanner.ts +36 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2022 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#include "AZDetector.h"
|
|
9
|
+
|
|
10
|
+
#include "AZDetectorResult.h"
|
|
11
|
+
#include "BitArray.h"
|
|
12
|
+
#include "BitMatrix.h"
|
|
13
|
+
#include "BitMatrixCursor.h"
|
|
14
|
+
#include "ConcentricFinder.h"
|
|
15
|
+
#include "GridSampler.h"
|
|
16
|
+
#include "LocalGrid.h"
|
|
17
|
+
#include "LogMatrix.h"
|
|
18
|
+
#include "Pattern.h"
|
|
19
|
+
#include "ReedSolomon.h"
|
|
20
|
+
#include "ZXAlgorithms.h"
|
|
21
|
+
|
|
22
|
+
#include <algorithm>
|
|
23
|
+
#include <bit>
|
|
24
|
+
#include <optional>
|
|
25
|
+
#include <ranges>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
#ifndef PRINT_DEBUG
|
|
29
|
+
#define printf(...){}
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
namespace ZXing::Aztec {
|
|
33
|
+
|
|
34
|
+
static bool IsAztecCenterPattern(const PatternView& view)
|
|
35
|
+
{
|
|
36
|
+
// find min/max of all subsequent black/white pairs and check that they 'close together'
|
|
37
|
+
auto m = view[0] + view[1];
|
|
38
|
+
auto M = m;
|
|
39
|
+
for (int i = 1; i < Size(view) - 1; ++i) {
|
|
40
|
+
int v = view[i] + view[i + 1];
|
|
41
|
+
UpdateMinMax(m, M, v);
|
|
42
|
+
}
|
|
43
|
+
return M <= m * 4 / 3 + 1 && view[-1] >= view[Size(view) / 2] - 2 && view[Size(view)] >= view[Size(view) / 2] - 2;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// specialized version of FindLeftGuard to find the '1,1,1,1,1,1,1' pattern of a compact Aztec center pattern
|
|
47
|
+
static PatternView FindAztecCenterPattern(const PatternView& view)
|
|
48
|
+
{
|
|
49
|
+
constexpr int minSize = 8; // Aztec runes
|
|
50
|
+
auto window = view.subView(0, 7);
|
|
51
|
+
for (auto end = view.end() - minSize; window.data() < end; window.skipPair())
|
|
52
|
+
if (IsAztecCenterPattern(window))
|
|
53
|
+
return window;
|
|
54
|
+
|
|
55
|
+
return {};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
static int CheckSymmetricAztecCenterPattern(BitMatrixCursorI& cur, int range, bool updatePosition)
|
|
59
|
+
{
|
|
60
|
+
range *= 2; // tilted symbols may have a larger vertical than horizontal range
|
|
61
|
+
|
|
62
|
+
FastEdgeToEdgeCounter curFwd(cur), curBwd(cur.turnedBack());
|
|
63
|
+
|
|
64
|
+
int centerFwd = curFwd.stepToNextEdge(range / 7);
|
|
65
|
+
if (!centerFwd)
|
|
66
|
+
return 0;
|
|
67
|
+
int centerBwd = curBwd.stepToNextEdge(range / 7);
|
|
68
|
+
if (!centerBwd)
|
|
69
|
+
return 0;
|
|
70
|
+
int center = centerFwd + centerBwd - 1; // -1 because the starting pixel is counted twice
|
|
71
|
+
if (center > range / 7 || center < range / (4 * 7))
|
|
72
|
+
return 0;
|
|
73
|
+
|
|
74
|
+
int spread = center;
|
|
75
|
+
int m = 0;
|
|
76
|
+
int M = 0;
|
|
77
|
+
for (auto c : {&curFwd, &curBwd}) {
|
|
78
|
+
int lastS = center;
|
|
79
|
+
for (int i = 0; i < 3; ++i) {
|
|
80
|
+
int s = c->stepToNextEdge(range - spread);
|
|
81
|
+
if (s == 0)
|
|
82
|
+
return 0;
|
|
83
|
+
int v = s + lastS;
|
|
84
|
+
if (m == 0)
|
|
85
|
+
m = M = v;
|
|
86
|
+
else
|
|
87
|
+
UpdateMinMax(m, M, v);
|
|
88
|
+
if (M > m * 4 / 3 + 1)
|
|
89
|
+
return 0;
|
|
90
|
+
spread += s;
|
|
91
|
+
lastS = s;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (updatePosition)
|
|
96
|
+
cur.step(centerFwd - centerBwd);
|
|
97
|
+
|
|
98
|
+
return spread;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static std::optional<ConcentricPattern> LocateAztecCenter(const BitMatrix& image, PointF center, int spreadH)
|
|
102
|
+
{
|
|
103
|
+
auto cur = BitMatrixCursor(image, PointI(center), {});
|
|
104
|
+
int minSpread = spreadH, maxSpread = 0;
|
|
105
|
+
for (auto d : {PointI{0, 1}, {1, 0}, {1, 1}, {1, -1}}) {
|
|
106
|
+
int spread = CheckSymmetricAztecCenterPattern(cur.setDirection(d), spreadH, d.x == 0);
|
|
107
|
+
if (!spread)
|
|
108
|
+
return {};
|
|
109
|
+
UpdateMinMax(minSpread, maxSpread, spread);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return ConcentricPattern{centered(cur.p), (maxSpread + minSpread) / 2.0};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static std::vector<ConcentricPattern> FindPureFinderPattern(const BitMatrix& image)
|
|
116
|
+
{
|
|
117
|
+
int left, top, width, height;
|
|
118
|
+
if (!image.findBoundingBox(left, top, width, height, 11)) { // 11 is the size of an Aztec Rune, see ISO/IEC 24778:2008(E) Annex A
|
|
119
|
+
// Runes 68 and 223 have none of their bits set on the bottom row
|
|
120
|
+
if (image.findBoundingBox(left, top, width, height, 10) && (width == 11) && (height == 10))
|
|
121
|
+
height = 11;
|
|
122
|
+
else
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Symbols can have a blank row or column at the edge (in particular, top and left)
|
|
127
|
+
if (width < height && image.width() >= height) {
|
|
128
|
+
left = std::max(0, left - (height - width + 1) / 2); // No real net effect if right edge blank
|
|
129
|
+
width = height;
|
|
130
|
+
} else if (height < width && image.height() >= width) {
|
|
131
|
+
top = std::max(0, top - (width - height + 1) / 2); // No real net effect if bottom edge blank
|
|
132
|
+
height = width;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
PointF p(left + width / 2, top + height / 2);
|
|
136
|
+
constexpr auto PATTERN = FixedPattern<7, 7>{1, 1, 1, 1, 1, 1, 1};
|
|
137
|
+
if (auto pattern = LocateConcentricPattern(image, PATTERN, p, width))
|
|
138
|
+
return {*pattern};
|
|
139
|
+
else
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static std::vector<ConcentricPattern> FindFinderPatterns(const BitMatrix& image, bool tryHarder)
|
|
144
|
+
{
|
|
145
|
+
std::vector<ConcentricPattern> res;
|
|
146
|
+
|
|
147
|
+
[[maybe_unused]] int N = 0;
|
|
148
|
+
|
|
149
|
+
#if 0 // reference algorithm for finding aztec center candidates
|
|
150
|
+
constexpr auto PATTERN = FixedPattern<7, 7>{1, 1, 1, 1, 1, 1, 1};
|
|
151
|
+
auto l0 = image.row(0);
|
|
152
|
+
std::vector<uint8_t> line(l0.begin(), l0.end());
|
|
153
|
+
const int width = image.width();
|
|
154
|
+
|
|
155
|
+
int skip = tryHarder ? 1 : std::clamp(image.height() / 100, 1, 3);
|
|
156
|
+
int margin = skip;
|
|
157
|
+
for (int y = margin; y < image.height() - margin; y += skip) {
|
|
158
|
+
auto lc = image.row(y).begin() + 1;
|
|
159
|
+
auto lp = image.row(y - skip).begin() + 1;
|
|
160
|
+
line.front() = image.get(0, y);
|
|
161
|
+
// update line and swipe right
|
|
162
|
+
for (int x = 1; x < image.width(); ++x) {
|
|
163
|
+
line[x] += *lc++ != *lp++;
|
|
164
|
+
while (line[x] > line[x - 1] + 1)
|
|
165
|
+
line[x] -= 2;
|
|
166
|
+
}
|
|
167
|
+
// swipe left
|
|
168
|
+
line.back() = image.get(width - 1, y);
|
|
169
|
+
for (int x = width - 2; x > 0; --x)
|
|
170
|
+
while (line[x] > line[x + 1] + 1)
|
|
171
|
+
line[x] -= 2;
|
|
172
|
+
|
|
173
|
+
int first = 0, last = 0;
|
|
174
|
+
for (int x = 1; x < width - 5; ++x) {
|
|
175
|
+
if (line[x] > line[x - 1] && line[x] >= 5 && line[x] % 2 == 1)
|
|
176
|
+
first = x;
|
|
177
|
+
else
|
|
178
|
+
continue;
|
|
179
|
+
while (line[x] == line[x + 1])
|
|
180
|
+
++x;
|
|
181
|
+
last = x;
|
|
182
|
+
if (line[last + 1] < line[last]) {
|
|
183
|
+
auto p = centered(PointI((first + last) / 2, y));
|
|
184
|
+
// make sure p is not 'inside' an already found pattern area
|
|
185
|
+
if (FindIf(res, [p](const auto& old) { return distance(p, old) < old.size / 2; }) == res.end()) {
|
|
186
|
+
++N;
|
|
187
|
+
auto pattern = LocateConcentricPattern(image, PATTERN, p, image.width() / 3);
|
|
188
|
+
if (pattern){
|
|
189
|
+
log(*pattern, 2);
|
|
190
|
+
res.push_back(*pattern);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
#else // own algorithm based on PatternRow processing (between 0% and 100% faster than reference algo depending on input)
|
|
197
|
+
int skip = tryHarder ? 1 : std::clamp(image.height() / 2 / 100, 1, 5);
|
|
198
|
+
int margin = tryHarder ? 5 : image.height() / 4;
|
|
199
|
+
|
|
200
|
+
PatternRow row;
|
|
201
|
+
|
|
202
|
+
for (int y = margin; y < image.height() - margin; y += skip)
|
|
203
|
+
{
|
|
204
|
+
GetPatternRow(image, y, row, false);
|
|
205
|
+
PatternView next = row;
|
|
206
|
+
next.shift(1); // the center pattern we are looking for starts with white and is 7 wide (compact code)
|
|
207
|
+
|
|
208
|
+
#if 1
|
|
209
|
+
while (next = FindAztecCenterPattern(next), next.isValid()) {
|
|
210
|
+
#else
|
|
211
|
+
constexpr auto PATTERN = FixedPattern<7, 7>{1, 1, 1, 1, 1, 1, 1};
|
|
212
|
+
while (next = FindLeftGuard(next, 0, PATTERN, 0.5), next.isValid()) {
|
|
213
|
+
#endif
|
|
214
|
+
PointF p(next.pixelsInFront() + next[0] + next[1] + next[2] + next[3] / 2.0, y + 0.5);
|
|
215
|
+
|
|
216
|
+
// make sure p is not 'inside' an already found pattern area
|
|
217
|
+
bool found = false;
|
|
218
|
+
for (auto& old : std::ranges::reverse_view(res)) {
|
|
219
|
+
// search from back to front, stop once we are out of range due to the y-coordinate
|
|
220
|
+
if (p.y - old.y > old.size / 2)
|
|
221
|
+
break;
|
|
222
|
+
if (distance(p, old) < old.size / 2) {
|
|
223
|
+
found = true;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!found) {
|
|
229
|
+
++N;
|
|
230
|
+
log(p, 1);
|
|
231
|
+
|
|
232
|
+
auto pattern = LocateAztecCenter(image, p, next.sum());
|
|
233
|
+
if (pattern) {
|
|
234
|
+
log(*pattern, 3);
|
|
235
|
+
assert(image.get(*pattern));
|
|
236
|
+
res.push_back(*pattern);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
next.skipPair();
|
|
241
|
+
next.extend();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
#endif
|
|
245
|
+
|
|
246
|
+
#ifdef PRINT_DEBUG
|
|
247
|
+
printf("\n# checked centers: %d, # found centers: %d\n", N, Size(res));
|
|
248
|
+
#endif
|
|
249
|
+
return res;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
static int FindRotation(uint32_t bits, bool mirror)
|
|
253
|
+
{
|
|
254
|
+
const uint32_t mask = mirror ? 0b111'000'001'110 : 0b111'011'100'000;
|
|
255
|
+
for (int i = 0; i < 4; ++i) {
|
|
256
|
+
if (std::popcount(mask ^ bits) <= 2) // at most 2 bits may be wrong (24778:2008(E) 14.3.3 says 3 but that is wrong)
|
|
257
|
+
return i;
|
|
258
|
+
bits = ((bits << 3) & 0xfff) | ((bits >> 9) & 0b111); // left shift/rotate, see RotatedCorners(Quadrilateral)
|
|
259
|
+
}
|
|
260
|
+
return -1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// read 4*3=12 bits from the 4 corners of the finder pattern at radius
|
|
264
|
+
static uint32_t SampleOrientationBits(const BitMatrix& image, const PerspectiveTransform& mod2Pix, int radius)
|
|
265
|
+
{
|
|
266
|
+
uint32_t bits = 0;
|
|
267
|
+
for (auto d : {PointI{-1, -1}, {1, -1}, {1, 1}, {-1, 1}}) {
|
|
268
|
+
auto corner = radius * d;
|
|
269
|
+
auto cornerL = corner + PointI{0, -d.y};
|
|
270
|
+
auto cornerR = corner + PointI{-d.x, 0};
|
|
271
|
+
if (d.x != d.y)
|
|
272
|
+
std::swap(cornerL, cornerR);
|
|
273
|
+
for (auto ps : {cornerL, corner, cornerR}) {
|
|
274
|
+
auto p = mod2Pix(PointF(ps));
|
|
275
|
+
if (!image.isIn(p))
|
|
276
|
+
return 0;
|
|
277
|
+
log(p);
|
|
278
|
+
AppendBit(bits, image.get(p));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return bits;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static int ModeMessage(const BitMatrix& image, const PerspectiveTransform& mod2Pix, int radius, bool& isRune)
|
|
285
|
+
{
|
|
286
|
+
const bool compact = radius == 5;
|
|
287
|
+
isRune = false;
|
|
288
|
+
|
|
289
|
+
// read the bits between the corner bits along the 4 edges
|
|
290
|
+
uint64_t bits = 0;
|
|
291
|
+
for (auto d : {PointI{-1, -1}, {1, -1}, {1, 1}, {-1, 1}}) {
|
|
292
|
+
auto corner = radius * d;
|
|
293
|
+
auto next = (d.x == d.y) ? PointI{-d.x, 0} : PointI{0, -d.y};
|
|
294
|
+
for (int i = 2; i <= 2 * radius - 2; ++i) {
|
|
295
|
+
if (!compact && i == 7)
|
|
296
|
+
continue; // skip the timing pattern
|
|
297
|
+
auto p = mod2Pix(PointF(corner + i * next));
|
|
298
|
+
log(p);
|
|
299
|
+
if (!image.isIn(p))
|
|
300
|
+
return -1;
|
|
301
|
+
AppendBit(bits, image.get(p));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// error correct bits
|
|
306
|
+
int numCodewords = compact ? 7 : 10;
|
|
307
|
+
int numDataCodewords = compact ? 2 : 4;
|
|
308
|
+
int numECCodewords = numCodewords - numDataCodewords;
|
|
309
|
+
|
|
310
|
+
std::vector<int> words(numCodewords);
|
|
311
|
+
for (int i = numCodewords - 1; i >= 0; --i) {
|
|
312
|
+
words[i] = narrow_cast<int>(bits & 0xF);
|
|
313
|
+
bits >>= 4;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
auto decodeResult = ReedSolomonDecode(GF2nAztec(4), words, numECCodewords);
|
|
317
|
+
|
|
318
|
+
if ((!decodeResult) && compact) {
|
|
319
|
+
// Is this a Rune?
|
|
320
|
+
for (auto& word : words)
|
|
321
|
+
word ^= 0b1010;
|
|
322
|
+
|
|
323
|
+
decodeResult = ReedSolomonDecode(GF2nAztec(4), words, numECCodewords);
|
|
324
|
+
|
|
325
|
+
if (decodeResult)
|
|
326
|
+
isRune = true;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (!decodeResult)
|
|
330
|
+
return -1;
|
|
331
|
+
|
|
332
|
+
int res = 0;
|
|
333
|
+
for (int i = 0; i < numDataCodewords; i++)
|
|
334
|
+
res = (res << 4) + words[i];
|
|
335
|
+
|
|
336
|
+
return res;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
static void ExtractParameters(int modeMessage, bool compact, int& nbLayers, int& nbDataBlocks, bool& readerInit)
|
|
340
|
+
{
|
|
341
|
+
readerInit = false;
|
|
342
|
+
if (compact) {
|
|
343
|
+
// 8 bits: 2 bits layers and 6 bits data blocks
|
|
344
|
+
nbLayers = (modeMessage >> 6) + 1;
|
|
345
|
+
if (nbLayers == 1 && (modeMessage & 0x20)) { // ISO/IEC 24778:2008 Section 9 MSB artificially set
|
|
346
|
+
readerInit = true;
|
|
347
|
+
modeMessage &= ~0x20;
|
|
348
|
+
}
|
|
349
|
+
nbDataBlocks = (modeMessage & 0x3F) + 1;
|
|
350
|
+
} else {
|
|
351
|
+
// 16 bits: 5 bits layers and 11 bits data blocks
|
|
352
|
+
nbLayers = (modeMessage >> 11) + 1;
|
|
353
|
+
if (nbLayers <= 22 && (modeMessage & 0x400)) { // ISO/IEC 24778:2008 Section 9 MSB artificially set
|
|
354
|
+
readerInit = true;
|
|
355
|
+
modeMessage &= ~0x400;
|
|
356
|
+
}
|
|
357
|
+
nbDataBlocks = (modeMessage & 0x7FF) + 1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
DetectorResult Detect(const BitMatrix& image, bool isPure, bool tryHarder, bool standard, bool runes)
|
|
362
|
+
{
|
|
363
|
+
return FirstOrDefault(Detect(image, isPure, tryHarder, 1, standard, runes));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
DetectorResults Detect(const BitMatrix& image, bool isPure, bool tryHarder, int maxSymbols, bool standard, bool runes)
|
|
367
|
+
{
|
|
368
|
+
#ifdef PRINT_DEBUG
|
|
369
|
+
LogMatrixWriter lmw(log, image, 5, "az-log.pnm");
|
|
370
|
+
#endif
|
|
371
|
+
|
|
372
|
+
DetectorResults res;
|
|
373
|
+
auto fps = isPure ? FindPureFinderPattern(image) : FindFinderPatterns(image, tryHarder);
|
|
374
|
+
for (const auto& fp : fps) {
|
|
375
|
+
auto fpQuad = FindConcentricPatternCorners(image, fp, fp.size, 3);
|
|
376
|
+
if (!fpQuad)
|
|
377
|
+
continue;
|
|
378
|
+
|
|
379
|
+
auto srcQuad = CenteredSquare(7);
|
|
380
|
+
auto mod2Pix = PerspectiveTransform(srcQuad, *fpQuad);
|
|
381
|
+
if (!mod2Pix.isValid())
|
|
382
|
+
continue;
|
|
383
|
+
|
|
384
|
+
int radius; // 5 or 7 (compact vs. full)
|
|
385
|
+
int mirror; // 0 or 1
|
|
386
|
+
int rotate; // [0..3]
|
|
387
|
+
int modeMessage = -1;
|
|
388
|
+
bool isRune = false;
|
|
389
|
+
|
|
390
|
+
auto parseModeMessage = [&image, &radius, &mirror, &rotate, &modeMessage, &isRune](QuadrilateralF srcQuad, QuadrilateralF fpQuad) {
|
|
391
|
+
// 24778:2008(E) 14.3.3 reads:
|
|
392
|
+
// In the outer layer of the Core Symbol, the 12 orientation bits at the corners are bitwise compared against the specified
|
|
393
|
+
// pattern in each of four possible orientations and their four mirror inverse orientations as well. If in any of the 8
|
|
394
|
+
// cases checked as many as 9 of the 12 bits correctly match, that is deemed to be the correct orientation, otherwise
|
|
395
|
+
// decoding fails.
|
|
396
|
+
// Unfortunately, this seems to be wrong: there are 12-bit patterns in those 8 cases that differ only in 4 bits like
|
|
397
|
+
// 011'100'000'111 (rot90 && !mirror) and 111'000'001'110 (rot0 && mirror), meaning if two of those are wrong, both cases
|
|
398
|
+
// have a hamming distance of 2, meaning only 1 bit errors can be reliable recovered from. The following code therefore
|
|
399
|
+
// incorporates the complete set of mode message bits to help determine the orientation of the symbol. This is still not
|
|
400
|
+
// sufficient for the ErrorInModeMessageZero test case in AZDecoderTest.cpp but good enough for the author.
|
|
401
|
+
for (radius = 5; radius <= 7; radius += 2) {
|
|
402
|
+
uint32_t bits = SampleOrientationBits(image, PerspectiveTransform(srcQuad, fpQuad), radius);
|
|
403
|
+
if (bits == 0)
|
|
404
|
+
continue;
|
|
405
|
+
for (mirror = 0; mirror <= 1; ++mirror) {
|
|
406
|
+
rotate = FindRotation(bits, mirror);
|
|
407
|
+
if (rotate == -1)
|
|
408
|
+
continue;
|
|
409
|
+
modeMessage = ModeMessage(image, PerspectiveTransform(srcQuad, RotatedCorners(fpQuad, rotate, mirror)), radius, isRune);
|
|
410
|
+
if (modeMessage != -1)
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
#if 1
|
|
418
|
+
if (!parseModeMessage(srcQuad, *fpQuad) || radius == 7) {
|
|
419
|
+
// improve prescision of sample grid by extrapolating from outer square of white pixels (5 edges away from center)
|
|
420
|
+
if (auto fpQuad5 = FindConcentricPatternCorners(image, fp, fp.size * 5 / 3, 5)) {
|
|
421
|
+
if (parseModeMessage(CenteredSquare(11), *fpQuad5) && radius == 7) {
|
|
422
|
+
srcQuad = CenteredSquare(11);
|
|
423
|
+
fpQuad = fpQuad5;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (modeMessage == -1)
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
#else
|
|
430
|
+
if (!parseModeMessage(srcQuad, *fpQuad))
|
|
431
|
+
continue;
|
|
432
|
+
#endif
|
|
433
|
+
|
|
434
|
+
if ((!standard && !isRune) || (!runes && isRune))
|
|
435
|
+
continue;
|
|
436
|
+
|
|
437
|
+
*fpQuad = RotatedCorners(*fpQuad, rotate, mirror);
|
|
438
|
+
|
|
439
|
+
int nbLayers = 0;
|
|
440
|
+
int nbDataBlocks = 0;
|
|
441
|
+
bool readerInit = false;
|
|
442
|
+
if (!isRune) {
|
|
443
|
+
ExtractParameters(modeMessage, radius == 5, nbLayers, nbDataBlocks, readerInit);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
int dim = radius == 5 ? 4 * nbLayers + 11 : 4 * nbLayers + 2 * ((2 * nbLayers + 6) / 15) + 15;
|
|
447
|
+
|
|
448
|
+
auto center = PointF(dim / 2.0, dim / 2.0);
|
|
449
|
+
srcQuad = Move(srcQuad, center);
|
|
450
|
+
mod2Pix = PerspectiveTransform{srcQuad, *fpQuad};
|
|
451
|
+
|
|
452
|
+
ZXing::DetectorResult bits;
|
|
453
|
+
#if 1
|
|
454
|
+
// for symbols with timing patterns, find those starting from the center and successively move outward
|
|
455
|
+
if (dim >= 35) {
|
|
456
|
+
int R = (dim / 2) / 16;
|
|
457
|
+
int firstTimingPattern = dim / 2 - R * 16;
|
|
458
|
+
|
|
459
|
+
auto apM = std::vector<int>(); // alignment pattern positions in modules
|
|
460
|
+
for (int i = firstTimingPattern; i < dim; i += 16)
|
|
461
|
+
apM.push_back(i);//, printf("apM: %d\n", i);
|
|
462
|
+
auto apP = Matrix<std::optional<PointF>>(Size(apM), Size(apM)); // found/guessed alignment pattern positions in pixels
|
|
463
|
+
apP.set(Size(apM) / 2, Size(apM) / 2, mod2Pix(center)); // center point
|
|
464
|
+
|
|
465
|
+
for (int r = R-1; r >= 0; --r) {
|
|
466
|
+
srcQuad = Move(CenteredSquare(32 * (R - r)), center);
|
|
467
|
+
auto idxs = std::array<PointI, 4>{PointI{-1, -1}, {1, -1}, {1, 1}, {-1, 1}};
|
|
468
|
+
QuadrilateralF dstQuad;
|
|
469
|
+
for (int i = 0; i < 4; ++i) {
|
|
470
|
+
auto pi = (R - r) * idxs[i] + Size(apM) / 2 * PointI{1, 1};
|
|
471
|
+
printf("\nlocate %dx%d\n", pi.x, pi.y);
|
|
472
|
+
apP.set(pi.x, pi.y, LocalGrid(image, mod2Pix, PointI(srcQuad[i]), {dim, dim}).findTimingPatternCross(true, 4));
|
|
473
|
+
dstQuad[i] = apP(pi.x, pi.y).value_or(mod2Pix(srcQuad[i]));
|
|
474
|
+
log(dstQuad[i], 2);
|
|
475
|
+
}
|
|
476
|
+
mod2Pix = PerspectiveTransform(srcQuad, dstQuad);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
#if 1
|
|
480
|
+
// find the remaining (non-corner) alignment patterns
|
|
481
|
+
for (int y = 0; y < Size(apM); ++y)
|
|
482
|
+
for (int x = 0; x < Size(apM); ++x) {
|
|
483
|
+
if (!apP(x, y)) {
|
|
484
|
+
printf("\nlocate %dx%d\n", x, y);
|
|
485
|
+
apP.set(x, y, LocalGrid(image, mod2Pix, {apM[x], apM[y]}, {dim, dim}).findTimingPatternCross(true, 4));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
#endif
|
|
489
|
+
|
|
490
|
+
bits = SampleGrid(image, dim, dim, mod2Pix, std::move(apP), apM, apM);
|
|
491
|
+
}
|
|
492
|
+
else
|
|
493
|
+
#endif
|
|
494
|
+
bits = SampleGrid(image, dim, dim, mod2Pix);
|
|
495
|
+
|
|
496
|
+
if (!bits.isValid())
|
|
497
|
+
continue;
|
|
498
|
+
|
|
499
|
+
res.emplace_back(std::move(bits), radius == 5, nbDataBlocks, nbLayers, readerInit, mirror != 0, isRune ? modeMessage : -1);
|
|
500
|
+
|
|
501
|
+
if (Size(res) == maxSymbols)
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return res;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include <vector>
|
|
10
|
+
|
|
11
|
+
namespace ZXing {
|
|
12
|
+
|
|
13
|
+
class BitMatrix;
|
|
14
|
+
|
|
15
|
+
namespace Aztec {
|
|
16
|
+
|
|
17
|
+
class DetectorResult;
|
|
18
|
+
|
|
19
|
+
DetectorResult Detect(const BitMatrix& image, bool isPure, bool tryHarder = true, bool standard = true, bool runes = true);
|
|
20
|
+
|
|
21
|
+
using DetectorResults = std::vector<DetectorResult>;
|
|
22
|
+
DetectorResults Detect(const BitMatrix& image, bool isPure, bool tryHarder, int maxSymbols, bool standard = true, bool runes = true);
|
|
23
|
+
|
|
24
|
+
} // Aztec
|
|
25
|
+
} // ZXing
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "DetectorResult.h"
|
|
10
|
+
|
|
11
|
+
#include <utility>
|
|
12
|
+
|
|
13
|
+
namespace ZXing::Aztec {
|
|
14
|
+
|
|
15
|
+
class DetectorResult : public ZXing::DetectorResult
|
|
16
|
+
{
|
|
17
|
+
bool _compact = false;
|
|
18
|
+
int _nbDatablocks = 0;
|
|
19
|
+
int _nbLayers = 0;
|
|
20
|
+
bool _readerInit = false;
|
|
21
|
+
bool _isMirrored = false;
|
|
22
|
+
int _runeValue = -1;
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
DetectorResult() = default;
|
|
26
|
+
DetectorResult(DetectorResult&&) noexcept = default;
|
|
27
|
+
DetectorResult& operator=(DetectorResult&&) noexcept = default;
|
|
28
|
+
DetectorResult(const DetectorResult&) = delete;
|
|
29
|
+
DetectorResult& operator=(const DetectorResult&) = delete;
|
|
30
|
+
|
|
31
|
+
DetectorResult(ZXing::DetectorResult&& result, bool isCompact, int nbDatablocks, int nbLayers, bool readerInit, bool isMirrored, int runeValue)
|
|
32
|
+
: ZXing::DetectorResult{std::move(result)},
|
|
33
|
+
_compact(isCompact),
|
|
34
|
+
_nbDatablocks(nbDatablocks),
|
|
35
|
+
_nbLayers(nbLayers),
|
|
36
|
+
_readerInit(readerInit),
|
|
37
|
+
_isMirrored(isMirrored),
|
|
38
|
+
_runeValue(runeValue)
|
|
39
|
+
{}
|
|
40
|
+
|
|
41
|
+
bool isCompact() const { return _compact; }
|
|
42
|
+
int nbDatablocks() const { return _nbDatablocks; }
|
|
43
|
+
int nbLayers() const { return _nbLayers; }
|
|
44
|
+
bool readerInit() const { return _readerInit; }
|
|
45
|
+
bool isMirrored() const { return _isMirrored; }
|
|
46
|
+
|
|
47
|
+
// Only meaningful is nbDatablocks == 0
|
|
48
|
+
int runeValue() const { return _runeValue; }
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
} // namespace ZXing::Aztec
|