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,259 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2020 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#include "ODReader.h"
|
|
9
|
+
|
|
10
|
+
#include "BinaryBitmap.h"
|
|
11
|
+
#include "ReaderOptions.h"
|
|
12
|
+
#include "ODCodabarReader.h"
|
|
13
|
+
#include "ODCode128Reader.h"
|
|
14
|
+
#include "ODCode39Reader.h"
|
|
15
|
+
#include "ODCode93Reader.h"
|
|
16
|
+
#include "ODDataBarExpandedReader.h"
|
|
17
|
+
#include "ODDataBarLimitedReader.h"
|
|
18
|
+
#include "ODDataBarReader.h"
|
|
19
|
+
#include "ODDXFilmEdgeReader.h"
|
|
20
|
+
#include "ODITFReader.h"
|
|
21
|
+
#include "ODMultiUPCEANReader.h"
|
|
22
|
+
#include "ODTelepenReader.h"
|
|
23
|
+
#include "BarcodeData.h"
|
|
24
|
+
|
|
25
|
+
#include <algorithm>
|
|
26
|
+
#include <utility>
|
|
27
|
+
|
|
28
|
+
#ifdef PRINT_DEBUG
|
|
29
|
+
#include "BitMatrix.h"
|
|
30
|
+
#include "BitMatrixIO.h"
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
namespace ZXing::OneD {
|
|
34
|
+
|
|
35
|
+
Reader::Reader(const ReaderOptions& opts) : ZXing::Reader(opts)
|
|
36
|
+
{
|
|
37
|
+
using enum BarcodeFormat;
|
|
38
|
+
|
|
39
|
+
_readers.reserve(8);
|
|
40
|
+
|
|
41
|
+
if (opts.hasAnyFormat(EANUPC))
|
|
42
|
+
_readers.emplace_back(new MultiUPCEANReader(opts));
|
|
43
|
+
|
|
44
|
+
if (opts.hasAnyFormat(Code39))
|
|
45
|
+
_readers.emplace_back(new Code39Reader(opts));
|
|
46
|
+
if (opts.hasAnyFormat(Code93))
|
|
47
|
+
_readers.emplace_back(new Code93Reader(opts));
|
|
48
|
+
if (opts.hasAnyFormat(Code128))
|
|
49
|
+
_readers.emplace_back(new Code128Reader(opts));
|
|
50
|
+
if (opts.hasAnyFormat(ITF))
|
|
51
|
+
_readers.emplace_back(new ITFReader(opts));
|
|
52
|
+
if (opts.hasAnyFormat(Telepen))
|
|
53
|
+
_readers.emplace_back(new TelepenReader(opts));
|
|
54
|
+
if (opts.hasAnyFormat(Codabar))
|
|
55
|
+
_readers.emplace_back(new CodabarReader(opts));
|
|
56
|
+
if (opts.hasFormat(DataBar | DataBarOmni | DataBarStk | DataBarStkOmni))
|
|
57
|
+
_readers.emplace_back(new DataBarReader(opts));
|
|
58
|
+
if (opts.hasFormat(DataBar | DataBarExp | DataBarExpStk))
|
|
59
|
+
_readers.emplace_back(new DataBarExpandedReader(opts));
|
|
60
|
+
if (opts.hasFormat(DataBar | DataBarLtd))
|
|
61
|
+
_readers.emplace_back(new DataBarLimitedReader(opts));
|
|
62
|
+
if (opts.hasAnyFormat(DXFilmEdge))
|
|
63
|
+
_readers.emplace_back(new DXFilmEdgeReader(opts));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Reader::~Reader() = default;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* We're going to examine rows from the middle outward, searching alternately above and below the
|
|
70
|
+
* middle, and farther out each time. rowStep is the number of rows between each successive
|
|
71
|
+
* attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
|
|
72
|
+
* middle + rowStep, then middle - (2 * rowStep), etc.
|
|
73
|
+
* rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
|
|
74
|
+
* decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
|
|
75
|
+
* image if "trying harder".
|
|
76
|
+
*/
|
|
77
|
+
BarcodesData DoDecode(const std::vector<std::unique_ptr<RowReader>>& readers, const BinaryBitmap& image, bool tryHarder,
|
|
78
|
+
bool rotate, bool isPure, int maxSymbols, int minLineCount, bool returnErrors)
|
|
79
|
+
{
|
|
80
|
+
BarcodesData res;
|
|
81
|
+
|
|
82
|
+
std::vector<std::unique_ptr<RowReader::DecodingState>> decodingState(readers.size());
|
|
83
|
+
|
|
84
|
+
int width = image.width();
|
|
85
|
+
int height = image.height();
|
|
86
|
+
|
|
87
|
+
if (rotate)
|
|
88
|
+
std::swap(width, height);
|
|
89
|
+
|
|
90
|
+
int middle = height / 2;
|
|
91
|
+
// TODO: find a better heuristic/parameterization if maxSymbols != 1
|
|
92
|
+
int rowStep = std::max(1, height / ((tryHarder && !isPure) ? (maxSymbols == 1 ? 256 : 512) : 32));
|
|
93
|
+
int maxLines = tryHarder ?
|
|
94
|
+
height : // Look at the whole image, not just the center
|
|
95
|
+
15; // 15 rows spaced 1/32 apart is roughly the middle half of the image
|
|
96
|
+
|
|
97
|
+
if (isPure)
|
|
98
|
+
minLineCount = 1;
|
|
99
|
+
else
|
|
100
|
+
minLineCount = std::min(minLineCount, height);
|
|
101
|
+
std::vector<int> checkRows;
|
|
102
|
+
|
|
103
|
+
PatternRow bars;
|
|
104
|
+
bars.reserve(128); // e.g. EAN-13 has 59 bars/spaces
|
|
105
|
+
|
|
106
|
+
#ifdef PRINT_DEBUG
|
|
107
|
+
BitMatrix dbg(width, height);
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
for (int i = 0; i < maxLines; i++) {
|
|
111
|
+
|
|
112
|
+
// Scanning from the middle out. Determine which row we're looking at next:
|
|
113
|
+
int rowStepsAboveOrBelow = (i + 1) / 2;
|
|
114
|
+
bool isAbove = (i & 0x01) == 0; // i.e. is x even?
|
|
115
|
+
int rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
|
|
116
|
+
bool isCheckRow = false;
|
|
117
|
+
if (rowNumber < 0 || rowNumber >= height) {
|
|
118
|
+
// Oops, if we run off the top or bottom, stop
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// See if we have additional check rows (see below) to process
|
|
123
|
+
if (checkRows.size()) {
|
|
124
|
+
--i;
|
|
125
|
+
rowNumber = checkRows.back();
|
|
126
|
+
checkRows.pop_back();
|
|
127
|
+
isCheckRow = true;
|
|
128
|
+
if (rowNumber < 0 || rowNumber >= height)
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!image.getPatternRow(rowNumber, rotate ? 90 : 0, bars))
|
|
133
|
+
continue;
|
|
134
|
+
|
|
135
|
+
#ifdef PRINT_DEBUG
|
|
136
|
+
bool val = false;
|
|
137
|
+
int x = 0;
|
|
138
|
+
for (auto b : bars) {
|
|
139
|
+
for(unsigned j = 0; j < b; ++j)
|
|
140
|
+
dbg.set(x++, rowNumber, val);
|
|
141
|
+
val = !val;
|
|
142
|
+
}
|
|
143
|
+
#endif
|
|
144
|
+
|
|
145
|
+
// While we have the image data in a PatternRow, it's fairly cheap to reverse it in place to
|
|
146
|
+
// handle decoding upside down barcodes.
|
|
147
|
+
// TODO: the DataBarExpanded (stacked) decoder depends on seeing each line from both directions. This is
|
|
148
|
+
// 'surprising' and inconsistent. It also requires the decoderState to be shared between normal and reversed
|
|
149
|
+
// scans, which makes no sense in general because it would mix partial detection data from two codes of the same
|
|
150
|
+
// type next to each other. See also https://github.com/zxing-cpp/zxing-cpp/issues/87
|
|
151
|
+
for (bool upsideDown : {false, true}) {
|
|
152
|
+
// trying again?
|
|
153
|
+
if (upsideDown) {
|
|
154
|
+
// reverse the row and continue
|
|
155
|
+
std::reverse(bars.begin(), bars.end());
|
|
156
|
+
}
|
|
157
|
+
// Look for a barcode
|
|
158
|
+
for (size_t r = 0; r < readers.size(); ++r) {
|
|
159
|
+
// If this is a pure symbol, then checking a single non-empty line is sufficient for all but the stacked
|
|
160
|
+
// DataBar codes. They are the only ones using the decodingState, which we can use as a flag here.
|
|
161
|
+
if (isPure && i && !decodingState[r])
|
|
162
|
+
continue;
|
|
163
|
+
|
|
164
|
+
PatternView next(bars);
|
|
165
|
+
do {
|
|
166
|
+
BarcodeData result = readers[r]->decodePattern(rowNumber, next, decodingState[r]);
|
|
167
|
+
if (result.isValid() || (returnErrors && result.error)) {
|
|
168
|
+
result.lineCount++;
|
|
169
|
+
if (upsideDown) {
|
|
170
|
+
// update position (flip horizontally).
|
|
171
|
+
for (auto& p : result.position) {
|
|
172
|
+
p = {width - p.x - 1, p.y};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (rotate) {
|
|
176
|
+
for (auto& p : result.position) {
|
|
177
|
+
p = {p.y, width - p.x - 1};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// check if we know this code already
|
|
182
|
+
for (auto& other : res) {
|
|
183
|
+
if (result == other) {
|
|
184
|
+
// merge the position information
|
|
185
|
+
auto dTop = maxAbsComponent(other.position.topLeft() - result.position.topLeft());
|
|
186
|
+
auto dBot = maxAbsComponent(other.position.bottomLeft() - result.position.topLeft());
|
|
187
|
+
if (dTop < dBot || (dTop == dBot && rotate ^ (sumAbsComponent(other.position[0]) >
|
|
188
|
+
sumAbsComponent(result.position[0])))) {
|
|
189
|
+
other.position[0] = result.position[0];
|
|
190
|
+
other.position[1] = result.position[1];
|
|
191
|
+
} else {
|
|
192
|
+
other.position[2] = result.position[2];
|
|
193
|
+
other.position[3] = result.position[3];
|
|
194
|
+
}
|
|
195
|
+
other.lineCount++;
|
|
196
|
+
// clear the result, so we don't insert it again below
|
|
197
|
+
result = BarcodeData();
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (result.format != BarcodeFormat::None) {
|
|
203
|
+
res.push_back(std::move(result));
|
|
204
|
+
|
|
205
|
+
// if we found a valid code we have not seen before but a minLineCount > 1,
|
|
206
|
+
// add additional check rows above and below the current one
|
|
207
|
+
if (!isCheckRow && minLineCount > 1 && rowStep > 1) {
|
|
208
|
+
checkRows = {rowNumber - 1, rowNumber + 1};
|
|
209
|
+
if (rowStep > 2)
|
|
210
|
+
checkRows.insert(checkRows.end(), {rowNumber - 2, rowNumber + 2});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (maxSymbols && Reduce(res, 0, [&](int s, const BarcodeData& r) {
|
|
215
|
+
return s + (r.lineCount >= minLineCount);
|
|
216
|
+
}) == maxSymbols) {
|
|
217
|
+
goto out;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// make sure we make progress and we start the next try on a bar
|
|
221
|
+
next.shift(2 - (next.index() % 2));
|
|
222
|
+
next.extend();
|
|
223
|
+
} while (tryHarder && next.size());
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
out:
|
|
229
|
+
// remove all symbols with insufficient line count
|
|
230
|
+
std::erase_if(res, [&](auto&& r) { return r.lineCount < minLineCount; });
|
|
231
|
+
|
|
232
|
+
// if symbols overlap, remove the one with a lower line count
|
|
233
|
+
for (auto a = res.begin(); a != res.end(); ++a)
|
|
234
|
+
for (auto b = std::next(a); b != res.end(); ++b)
|
|
235
|
+
if (HaveIntersectingBoundingBoxes(a->position, b->position))
|
|
236
|
+
*(a->lineCount < b->lineCount ? a : b) = BarcodeData();
|
|
237
|
+
|
|
238
|
+
std::erase_if(res, [](auto&& r) { return r.format == BarcodeFormat::None; });
|
|
239
|
+
|
|
240
|
+
#ifdef PRINT_DEBUG
|
|
241
|
+
SaveAsPBM(dbg, rotate ? "od-log-r.pnm" : "od-log.pnm");
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
return res;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
BarcodesData Reader::read(const BinaryBitmap& image, int maxSymbols) const
|
|
248
|
+
{
|
|
249
|
+
auto resH =
|
|
250
|
+
DoDecode(_readers, image, _opts.tryHarder(), false, _opts.isPure(), maxSymbols, _opts.minLineCount(), _opts.returnErrors());
|
|
251
|
+
if ((!maxSymbols || Size(resH) < maxSymbols) && _opts.tryRotate()) {
|
|
252
|
+
auto resV = DoDecode(_readers, image, _opts.tryHarder(), true, _opts.isPure(), maxSymbols - Size(resH),
|
|
253
|
+
_opts.minLineCount(), _opts.returnErrors());
|
|
254
|
+
resH.insert(resH.end(), std::make_move_iterator(resV.begin()), std::make_move_iterator(resV.end()));
|
|
255
|
+
}
|
|
256
|
+
return resH;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,35 @@
|
|
|
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 "Reader.h"
|
|
10
|
+
|
|
11
|
+
#include <memory>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
namespace ZXing {
|
|
15
|
+
|
|
16
|
+
class ReaderOptions;
|
|
17
|
+
|
|
18
|
+
namespace OneD {
|
|
19
|
+
|
|
20
|
+
class RowReader;
|
|
21
|
+
|
|
22
|
+
class Reader : public ZXing::Reader
|
|
23
|
+
{
|
|
24
|
+
public:
|
|
25
|
+
explicit Reader(const ReaderOptions& opts);
|
|
26
|
+
~Reader() override;
|
|
27
|
+
|
|
28
|
+
BarcodesData read(const BinaryBitmap& image, int maxSymbols) const override;
|
|
29
|
+
|
|
30
|
+
private:
|
|
31
|
+
std::vector<std::unique_ptr<RowReader>> _readers;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
} // OneD
|
|
35
|
+
} // ZXing
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2020 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "BitArray.h"
|
|
11
|
+
#include "Pattern.h"
|
|
12
|
+
#include "BarcodeData.h"
|
|
13
|
+
#include "ZXAlgorithms.h"
|
|
14
|
+
|
|
15
|
+
#include <algorithm>
|
|
16
|
+
#include <cassert>
|
|
17
|
+
#include <cmath>
|
|
18
|
+
#include <cstddef>
|
|
19
|
+
#include <iterator>
|
|
20
|
+
#include <limits>
|
|
21
|
+
#include <memory>
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
Code39 : 1:2/3, 5+4+1 (0x3|2x1 wide) -> 12-15 mods, v1-? | ToNarrowWide(OMG 1) == *
|
|
25
|
+
Codabar: 1:2/3, 4+3+1 (1x1|1x2|3x0 wide) -> 9-13 mods, v1-? | ToNarrowWide(OMG 2) == ABCD
|
|
26
|
+
ITF : 1:2/3, 5+5 (2x2 wide) -> mods, v6-?| .5, .38 == * | qz:10
|
|
27
|
+
|
|
28
|
+
Code93 : 1-4, 3+3 -> 9 mods v1-? | round to 1-4 == *
|
|
29
|
+
Code128: 1-4, 3+3 -> 11 mods v1-? | .7, .25 == ABC | qz:10
|
|
30
|
+
UPC/EAN: 1-4, 2+2 -> 7 mods f | .7, .48 == *
|
|
31
|
+
UPC-A: 11d 95m = 3 + 6*4 + 5 + 6*4 + 3 = 59 | qz:3
|
|
32
|
+
EAN-13: 12d 95m
|
|
33
|
+
UPC-E: 6d, 3 + 6*4 + 6 = 33
|
|
34
|
+
EAN-8: 8d, 3 + 4*4 + 5 + 4*4 + 3 = 43
|
|
35
|
+
|
|
36
|
+
RSS14 : 1-8, finder: (15,2+3), symbol: (15/16,4+4) | .45, .2 (finder only), 14d
|
|
37
|
+
code = 2xguard + 2xfinder + 4xsymbol = (96,23), stacked = 2x50 mods
|
|
38
|
+
RSSExp.: v?-74d/?-41c
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
namespace ZXing {
|
|
42
|
+
|
|
43
|
+
class ReaderOptions;
|
|
44
|
+
|
|
45
|
+
namespace OneD {
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Encapsulates functionality and implementation that is common to all families
|
|
49
|
+
* of one-dimensional barcodes.
|
|
50
|
+
*/
|
|
51
|
+
class RowReader
|
|
52
|
+
{
|
|
53
|
+
protected:
|
|
54
|
+
const ReaderOptions& _opts;
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
explicit RowReader(const ReaderOptions& opts) : _opts(opts) {}
|
|
58
|
+
explicit RowReader(ReaderOptions&&) = delete;
|
|
59
|
+
|
|
60
|
+
struct DecodingState
|
|
61
|
+
{
|
|
62
|
+
virtual ~DecodingState() = default;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
virtual ~RowReader() = default;
|
|
66
|
+
|
|
67
|
+
virtual BarcodeData decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>& state) const = 0;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Determines how closely a set of observed counts of runs of black/white values matches a given
|
|
71
|
+
* target pattern. This is reported as the ratio of the total variance from the expected pattern
|
|
72
|
+
* proportions across all pattern elements, to the length of the pattern.
|
|
73
|
+
*
|
|
74
|
+
* @param counters observed counters
|
|
75
|
+
* @param pattern expected pattern
|
|
76
|
+
* @param maxIndividualVariance The most any counter can differ before we give up
|
|
77
|
+
* @return ratio of total variance between counters and pattern compared to total pattern size
|
|
78
|
+
*/
|
|
79
|
+
template <typename CP, typename PP>
|
|
80
|
+
static float PatternMatchVariance(const CP* counters, const PP* pattern, size_t length, float maxIndividualVariance)
|
|
81
|
+
{
|
|
82
|
+
int total = Reduce(counters, counters + length, 0);
|
|
83
|
+
int patternLength = Reduce(pattern, pattern + length, 0);
|
|
84
|
+
if (total < patternLength) {
|
|
85
|
+
// If we don't even have one pixel per unit of bar width, assume this is too small
|
|
86
|
+
// to reliably match, so fail:
|
|
87
|
+
return std::numeric_limits<float>::max();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
float unitBarWidth = (float)total / patternLength;
|
|
91
|
+
maxIndividualVariance *= unitBarWidth;
|
|
92
|
+
|
|
93
|
+
float totalVariance = 0.0f;
|
|
94
|
+
for (size_t x = 0; x < length; ++x) {
|
|
95
|
+
float variance = std::abs(counters[x] - pattern[x] * unitBarWidth);
|
|
96
|
+
if (variance > maxIndividualVariance) {
|
|
97
|
+
return std::numeric_limits<float>::max();
|
|
98
|
+
}
|
|
99
|
+
totalVariance += variance;
|
|
100
|
+
}
|
|
101
|
+
return totalVariance / total;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
template <typename Counters, typename Pattern>
|
|
105
|
+
static float PatternMatchVariance(const Counters& counters, const Pattern& pattern, float maxIndividualVariance) {
|
|
106
|
+
assert(Size(counters) == Size(pattern));
|
|
107
|
+
return PatternMatchVariance(std::data(counters), std::data(pattern), std::size(counters), maxIndividualVariance);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Attempts to decode a sequence of black/white lines into single
|
|
112
|
+
* digit.
|
|
113
|
+
*
|
|
114
|
+
* @param counters the counts of runs of observed black/white/black/... values
|
|
115
|
+
* @param patterns the list of patterns to compare the contents of counters to
|
|
116
|
+
* @param requireUnambiguousMatch the 'best match' must be better than all other matches
|
|
117
|
+
* @return The decoded digit index, -1 if no pattern matched
|
|
118
|
+
*/
|
|
119
|
+
template <typename Counters, typename Patterns>
|
|
120
|
+
static int DecodeDigit(const Counters& counters, const Patterns& patterns, float maxAvgVariance,
|
|
121
|
+
float maxIndividualVariance, bool requireUnambiguousMatch = true)
|
|
122
|
+
{
|
|
123
|
+
float bestVariance = maxAvgVariance; // worst variance we'll accept
|
|
124
|
+
constexpr int INVALID_MATCH = -1;
|
|
125
|
+
int bestMatch = INVALID_MATCH;
|
|
126
|
+
for (int i = 0; i < Size(patterns); i++) {
|
|
127
|
+
float variance = PatternMatchVariance(counters, patterns[i], maxIndividualVariance);
|
|
128
|
+
if (variance < bestVariance) {
|
|
129
|
+
bestVariance = variance;
|
|
130
|
+
bestMatch = i;
|
|
131
|
+
} else if (requireUnambiguousMatch && variance == bestVariance) {
|
|
132
|
+
// if we find a second 'best match' with the same variance, we can not reliably report to have a suitable match
|
|
133
|
+
bestMatch = INVALID_MATCH;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return bestMatch;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @brief NarrowWideThreshold calculates width thresholds to separate narrow and wide bars and spaces.
|
|
141
|
+
*
|
|
142
|
+
* This is useful for codes like Codabar, Code39 and ITF which distinguish between narrow and wide
|
|
143
|
+
* bars/spaces. Where wide ones are between 2 and 3 times as wide as the narrow ones.
|
|
144
|
+
*
|
|
145
|
+
* @param view containing one character
|
|
146
|
+
* @return threshold value for bars and spaces
|
|
147
|
+
*/
|
|
148
|
+
static BarAndSpaceI NarrowWideThreshold(const PatternView& view)
|
|
149
|
+
{
|
|
150
|
+
BarAndSpaceI m = {view[0], view[1]};
|
|
151
|
+
BarAndSpaceI M = m;
|
|
152
|
+
for (int i = 2; i < view.size(); ++i)
|
|
153
|
+
UpdateMinMax(m[i], M[i], view[i]);
|
|
154
|
+
|
|
155
|
+
// the max-spread check between bar/space depends on whether both have seen narrow and wide
|
|
156
|
+
int maxSpread = M[0] >= 2 * m[0] && M[1] >= 2 * m[1] ? 2 : 4;
|
|
157
|
+
|
|
158
|
+
BarAndSpaceI res;
|
|
159
|
+
for (int i = 0; i < 2; ++i) {
|
|
160
|
+
// check that
|
|
161
|
+
// a) wide <= 4 * narrow
|
|
162
|
+
// b) bars and spaces are not more than a factor of spread apart from each other
|
|
163
|
+
if (M[i] > 4 * (m[i] + 1) || M[i] > maxSpread * M[i + 1] || m[i] > maxSpread * (m[i + 1] + 1))
|
|
164
|
+
return {};
|
|
165
|
+
// the threshold is the average of min and max but at least 1.5 * min
|
|
166
|
+
res[i] = std::max((m[i] + M[i]) / 2, m[i] * 3 / 2);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return res;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @brief ToNarrowWidePattern takes a PatternView, calculates a NarrowWideThreshold and returns int where a '0' bit
|
|
174
|
+
* means narrow and a '1' bit means 'wide'.
|
|
175
|
+
*/
|
|
176
|
+
static int NarrowWideBitPattern(const PatternView& view)
|
|
177
|
+
{
|
|
178
|
+
const auto threshold = NarrowWideThreshold(view);
|
|
179
|
+
if (!threshold.isValid())
|
|
180
|
+
return -1;
|
|
181
|
+
|
|
182
|
+
int pattern = 0;
|
|
183
|
+
for (int i = 0; i < view.size(); ++i) {
|
|
184
|
+
if (view[i] > threshold[i] * 2)
|
|
185
|
+
return -1;
|
|
186
|
+
AppendBit(pattern, view[i] > threshold[i]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return pattern;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @brief Lookup the pattern in the table and return the character in alphabet at the same index.
|
|
194
|
+
* @returns 0 if pattern is not found. Used to be -1 but that fails on systems where char is unsigned.
|
|
195
|
+
*/
|
|
196
|
+
template<typename INDEX, typename ALPHABET>
|
|
197
|
+
static char LookupBitPattern(int pattern, const INDEX& table, const ALPHABET& alphabet)
|
|
198
|
+
{
|
|
199
|
+
int i = IndexOf(table, pattern);
|
|
200
|
+
return i == -1 ? 0 : alphabet[i];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
template<typename INDEX, typename ALPHABET>
|
|
204
|
+
static char DecodeNarrowWidePattern(const PatternView& view, const INDEX& table, const ALPHABET& alphabet)
|
|
205
|
+
{
|
|
206
|
+
return LookupBitPattern(NarrowWideBitPattern(view), table, alphabet);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
template<typename Range>
|
|
211
|
+
Barcode DecodeSingleRow(const RowReader& reader, const Range& range)
|
|
212
|
+
{
|
|
213
|
+
PatternRow row;
|
|
214
|
+
GetPatternRow(range, row);
|
|
215
|
+
PatternView view(row);
|
|
216
|
+
|
|
217
|
+
std::unique_ptr<RowReader::DecodingState> state;
|
|
218
|
+
return {reader.decodePattern(0, view, state)};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
} // OneD
|
|
222
|
+
} // ZXing
|