zxing_cpp 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +3 -0
- data/Manifest.txt +331 -0
- data/README.rdoc +138 -0
- data/Rakefile +28 -0
- data/bin/zxd +87 -0
- data/bin/zxe +53 -0
- data/ext/zxing/extconf.rb +27 -0
- data/ext/zxing/zxing-cpp/.gitignore +4 -0
- data/ext/zxing/zxing-cpp/AUTHORS +115 -0
- data/ext/zxing/zxing-cpp/CMakeLists.txt +84 -0
- data/ext/zxing/zxing-cpp/COPYING +201 -0
- data/ext/zxing/zxing-cpp/NOTICE +65 -0
- data/ext/zxing/zxing-cpp/README.md +50 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +112 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
- data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
- data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
- data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +416 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +446 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +496 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +328 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +293 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +227 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +664 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +714 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +425 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +314 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
- data/ext/zxing/zxing.cc +224 -0
- data/lib/zxing.rb +50 -0
- data/lib/zxing/.gitignore +2 -0
- data/lib/zxing/aztec.rb +5 -0
- data/lib/zxing/aztec/aztec_reader.rb +14 -0
- data/lib/zxing/bad_image_exception.rb +4 -0
- data/lib/zxing/binarizer.rb +8 -0
- data/lib/zxing/binary_bitmap.rb +15 -0
- data/lib/zxing/checksum_exception.rb +4 -0
- data/lib/zxing/common.rb +7 -0
- data/lib/zxing/common/bit_matrix.rb +9 -0
- data/lib/zxing/common/hybrid_binarizer.rb +17 -0
- data/lib/zxing/common/illegal_argument_exception.rb +4 -0
- data/lib/zxing/datamatrix.rb +5 -0
- data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
- data/lib/zxing/decodable.rb +11 -0
- data/lib/zxing/exception.rb +4 -0
- data/lib/zxing/ffi.rb +20 -0
- data/lib/zxing/ffi/aztec.rb +6 -0
- data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
- data/lib/zxing/ffi/binarizer.rb +25 -0
- data/lib/zxing/ffi/binary_bitmap.rb +15 -0
- data/lib/zxing/ffi/common.rb +8 -0
- data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
- data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
- data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
- data/lib/zxing/ffi/datamatrix.rb +6 -0
- data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
- data/lib/zxing/ffi/library.rb +102 -0
- data/lib/zxing/ffi/luminance_source.rb +18 -0
- data/lib/zxing/ffi/multi_format_reader.rb +9 -0
- data/lib/zxing/ffi/oned.rb +6 -0
- data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
- data/lib/zxing/ffi/qrcode.rb +8 -0
- data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
- data/lib/zxing/ffi/qrcode/detector.rb +10 -0
- data/lib/zxing/ffi/reader.rb +58 -0
- data/lib/zxing/ffi/result.rb +23 -0
- data/lib/zxing/format_exception.rb +4 -0
- data/lib/zxing/illegal_argument_exception.rb +4 -0
- data/lib/zxing/image.rb +15 -0
- data/lib/zxing/luminance_source.rb +18 -0
- data/lib/zxing/multi_format_reader.rb +11 -0
- data/lib/zxing/not_found_exception.rb +4 -0
- data/lib/zxing/oned.rb +5 -0
- data/lib/zxing/oned/code_39_reader.rb +15 -0
- data/lib/zxing/qrcode.rb +8 -0
- data/lib/zxing/qrcode/decoder.rb +14 -0
- data/lib/zxing/qrcode/detector.rb +14 -0
- data/lib/zxing/qrcode/encoder.rb +8 -0
- data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
- data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
- data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
- data/lib/zxing/reader.rb +8 -0
- data/lib/zxing/reader_exception.rb +4 -0
- data/lib/zxing/reed_solomon_exception.rb +2 -0
- data/lib/zxing/result.rb +18 -0
- data/lib/zxing/rmagick.rb +5 -0
- data/lib/zxing/rmagick/image.rb +104 -0
- data/lib/zxing/version.rb +33 -0
- data/test/qrcode.png +0 -0
- data/test/test_helper.rb +5 -0
- data/test/test_zxing.rb +58 -0
- data/test/vendor.rb +360 -0
- data/test/zxing/test_decodable.rb +38 -0
- data/zxing_cpp.gemspec +48 -0
- metadata +473 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
#ifndef __DECODED_BIT_STREAM_PARSER_DM_H__
|
2
|
+
#define __DECODED_BIT_STREAM_PARSER_DM_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* DecodedBitStreamParser.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Created by Luiz Silva on 09/02/2010.
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <string>
|
25
|
+
#include <sstream>
|
26
|
+
#include <zxing/common/Array.h>
|
27
|
+
#include <zxing/common/BitSource.h>
|
28
|
+
#include <zxing/common/Counted.h>
|
29
|
+
#include <zxing/common/DecoderResult.h>
|
30
|
+
|
31
|
+
|
32
|
+
namespace zxing {
|
33
|
+
namespace datamatrix {
|
34
|
+
|
35
|
+
class DecodedBitStreamParser {
|
36
|
+
private:
|
37
|
+
static const int PAD_ENCODE = 0; // Not really an encoding
|
38
|
+
static const int ASCII_ENCODE = 1;
|
39
|
+
static const int C40_ENCODE = 2;
|
40
|
+
static const int TEXT_ENCODE = 3;
|
41
|
+
static const int ANSIX12_ENCODE = 4;
|
42
|
+
static const int EDIFACT_ENCODE = 5;
|
43
|
+
static const int BASE256_ENCODE = 6;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* See ISO 16022:2006, Annex C Table C.1
|
47
|
+
* The C40 Basic Character Set (*'s used for placeholders for the shift values)
|
48
|
+
*/
|
49
|
+
static const char C40_BASIC_SET_CHARS[];
|
50
|
+
|
51
|
+
static const char C40_SHIFT2_SET_CHARS[];
|
52
|
+
/**
|
53
|
+
* See ISO 16022:2006, Annex C Table C.2
|
54
|
+
* The Text Basic Character Set (*'s used for placeholders for the shift values)
|
55
|
+
*/
|
56
|
+
static const char TEXT_BASIC_SET_CHARS[];
|
57
|
+
|
58
|
+
static const char TEXT_SHIFT3_SET_CHARS[];
|
59
|
+
/**
|
60
|
+
* See ISO 16022:2006, 5.2.3 and Annex C, Table C.2
|
61
|
+
*/
|
62
|
+
int decodeAsciiSegment(Ref<BitSource> bits, std::ostringstream &result, std::ostringstream &resultTrailer);
|
63
|
+
/**
|
64
|
+
* See ISO 16022:2006, 5.2.5 and Annex C, Table C.1
|
65
|
+
*/
|
66
|
+
void decodeC40Segment(Ref<BitSource> bits, std::ostringstream &result);
|
67
|
+
/**
|
68
|
+
* See ISO 16022:2006, 5.2.6 and Annex C, Table C.2
|
69
|
+
*/
|
70
|
+
void decodeTextSegment(Ref<BitSource> bits, std::ostringstream &result);
|
71
|
+
/**
|
72
|
+
* See ISO 16022:2006, 5.2.7
|
73
|
+
*/
|
74
|
+
void decodeAnsiX12Segment(Ref<BitSource> bits, std::ostringstream &result);
|
75
|
+
/**
|
76
|
+
* See ISO 16022:2006, 5.2.8 and Annex C Table C.3
|
77
|
+
*/
|
78
|
+
void decodeEdifactSegment(Ref<BitSource> bits, std::ostringstream &result);
|
79
|
+
/**
|
80
|
+
* See ISO 16022:2006, 5.2.9 and Annex B, B.2
|
81
|
+
*/
|
82
|
+
void decodeBase256Segment(Ref<BitSource> bits, std::ostringstream &result, std::vector<char> byteSegments);
|
83
|
+
|
84
|
+
void parseTwoBytes(int firstByte, int secondByte, int* result);
|
85
|
+
/**
|
86
|
+
* See ISO 16022:2006, Annex B, B.2
|
87
|
+
*/
|
88
|
+
char unrandomize255State(int randomizedBase256Codeword,
|
89
|
+
int base256CodewordPosition) {
|
90
|
+
int pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;
|
91
|
+
int tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
|
92
|
+
return (char) (tempVariable >= 0 ? tempVariable : (tempVariable + 256));
|
93
|
+
};
|
94
|
+
void append(std::ostream &ost, const char *bufIn, size_t nIn, const char *src);
|
95
|
+
|
96
|
+
public:
|
97
|
+
DecodedBitStreamParser() { };
|
98
|
+
Ref<DecoderResult> decode(ArrayRef<char> bytes);
|
99
|
+
};
|
100
|
+
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
#endif // __DECODED_BIT_STREAM_PARSER_DM_H__
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/*
|
2
|
+
* Decoder.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Luiz Silva on 09/02/2010.
|
6
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include <zxing/datamatrix/decoder/Decoder.h>
|
22
|
+
#include <zxing/datamatrix/decoder/BitMatrixParser.h>
|
23
|
+
#include <zxing/datamatrix/decoder/DataBlock.h>
|
24
|
+
#include <zxing/datamatrix/decoder/DecodedBitStreamParser.h>
|
25
|
+
#include <zxing/datamatrix/Version.h>
|
26
|
+
#include <zxing/ReaderException.h>
|
27
|
+
#include <zxing/ChecksumException.h>
|
28
|
+
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
29
|
+
|
30
|
+
using zxing::Ref;
|
31
|
+
using zxing::DecoderResult;
|
32
|
+
using zxing::datamatrix::Decoder;
|
33
|
+
|
34
|
+
// VC++
|
35
|
+
using zxing::ArrayRef;
|
36
|
+
using zxing::BitMatrix;
|
37
|
+
|
38
|
+
Decoder::Decoder() : rsDecoder_(GenericGF::DATA_MATRIX_FIELD_256) {}
|
39
|
+
|
40
|
+
void Decoder::correctErrors(ArrayRef<char> codewordBytes, int numDataCodewords) {
|
41
|
+
int numCodewords = codewordBytes->size();
|
42
|
+
ArrayRef<int> codewordInts(numCodewords);
|
43
|
+
for (int i = 0; i < numCodewords; i++) {
|
44
|
+
codewordInts[i] = codewordBytes[i] & 0xff;
|
45
|
+
}
|
46
|
+
int numECCodewords = numCodewords - numDataCodewords;
|
47
|
+
try {
|
48
|
+
rsDecoder_.decode(codewordInts, numECCodewords);
|
49
|
+
} catch (ReedSolomonException const& ignored) {
|
50
|
+
(void)ignored;
|
51
|
+
throw ChecksumException();
|
52
|
+
}
|
53
|
+
// Copy back into array of bytes -- only need to worry about the bytes that were data
|
54
|
+
// We don't care about errors in the error-correction codewords
|
55
|
+
for (int i = 0; i < numDataCodewords; i++) {
|
56
|
+
codewordBytes[i] = (char)codewordInts[i];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
Ref<DecoderResult> Decoder::decode(Ref<BitMatrix> bits) {
|
61
|
+
// Construct a parser and read version, error-correction level
|
62
|
+
BitMatrixParser parser(bits);
|
63
|
+
Version *version = parser.readVersion(bits);
|
64
|
+
|
65
|
+
// Read codewords
|
66
|
+
ArrayRef<char> codewords(parser.readCodewords());
|
67
|
+
// Separate into data blocks
|
68
|
+
std::vector<Ref<DataBlock> > dataBlocks = DataBlock::getDataBlocks(codewords, version);
|
69
|
+
|
70
|
+
int dataBlocksCount = dataBlocks.size();
|
71
|
+
|
72
|
+
// Count total number of data bytes
|
73
|
+
int totalBytes = 0;
|
74
|
+
for (int i = 0; i < dataBlocksCount; i++) {
|
75
|
+
totalBytes += dataBlocks[i]->getNumDataCodewords();
|
76
|
+
}
|
77
|
+
ArrayRef<char> resultBytes(totalBytes);
|
78
|
+
|
79
|
+
// Error-correct and copy data blocks together into a stream of bytes
|
80
|
+
for (int j = 0; j < dataBlocksCount; j++) {
|
81
|
+
Ref<DataBlock> dataBlock(dataBlocks[j]);
|
82
|
+
ArrayRef<char> codewordBytes = dataBlock->getCodewords();
|
83
|
+
int numDataCodewords = dataBlock->getNumDataCodewords();
|
84
|
+
correctErrors(codewordBytes, numDataCodewords);
|
85
|
+
for (int i = 0; i < numDataCodewords; i++) {
|
86
|
+
// De-interlace data blocks.
|
87
|
+
resultBytes[i * dataBlocksCount + j] = codewordBytes[i];
|
88
|
+
}
|
89
|
+
}
|
90
|
+
// Decode the contents of that stream of bytes
|
91
|
+
DecodedBitStreamParser decodedBSParser;
|
92
|
+
return Ref<DecoderResult> (decodedBSParser.decode(resultBytes));
|
93
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#ifndef __DECODER_DM_H__
|
2
|
+
#define __DECODER_DM_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Decoder.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Created by Luiz Silva on 09/02/2010.
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
25
|
+
#include <zxing/common/Counted.h>
|
26
|
+
#include <zxing/common/Array.h>
|
27
|
+
#include <zxing/common/DecoderResult.h>
|
28
|
+
#include <zxing/common/BitMatrix.h>
|
29
|
+
|
30
|
+
|
31
|
+
namespace zxing {
|
32
|
+
namespace datamatrix {
|
33
|
+
|
34
|
+
class Decoder {
|
35
|
+
private:
|
36
|
+
ReedSolomonDecoder rsDecoder_;
|
37
|
+
|
38
|
+
void correctErrors(ArrayRef<char> bytes, int numDataCodewords);
|
39
|
+
|
40
|
+
public:
|
41
|
+
Decoder();
|
42
|
+
|
43
|
+
Ref<DecoderResult> decode(Ref<BitMatrix> bits);
|
44
|
+
};
|
45
|
+
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
#endif // __DECODER_DM_H__
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/*
|
2
|
+
* CornerPoint.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Luiz Silva on 09/02/2010.
|
6
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include <zxing/datamatrix/detector/CornerPoint.h>
|
22
|
+
|
23
|
+
|
24
|
+
namespace zxing {
|
25
|
+
namespace datamatrix {
|
26
|
+
|
27
|
+
using namespace std;
|
28
|
+
|
29
|
+
CornerPoint::CornerPoint(float posX, float posY) :
|
30
|
+
ResultPoint(posX,posY), counter_(0) {
|
31
|
+
}
|
32
|
+
|
33
|
+
int CornerPoint::getCount() const {
|
34
|
+
return counter_;
|
35
|
+
}
|
36
|
+
|
37
|
+
void CornerPoint::incrementCount() {
|
38
|
+
counter_++;
|
39
|
+
}
|
40
|
+
|
41
|
+
bool CornerPoint::equals(Ref<CornerPoint> other) const {
|
42
|
+
return posX_ == other->getX() && posY_ == other->getY();
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#ifndef __CORNER_FINDER_H__
|
2
|
+
#define __CORNER_FINDER_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* CornerPoint.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Created by Luiz Silva on 09/02/2010.
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <zxing/ResultPoint.h>
|
25
|
+
#include <cmath>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
namespace datamatrix {
|
29
|
+
|
30
|
+
class CornerPoint : public ResultPoint {
|
31
|
+
private:
|
32
|
+
int counter_;
|
33
|
+
|
34
|
+
public:
|
35
|
+
CornerPoint(float posX, float posY);
|
36
|
+
int getCount() const;
|
37
|
+
void incrementCount();
|
38
|
+
bool equals(Ref<CornerPoint> other) const;
|
39
|
+
};
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
#endif // __CORNER_FINDER_H__
|
@@ -0,0 +1,446 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* Detector.cpp
|
4
|
+
* zxing
|
5
|
+
*
|
6
|
+
* Created by Luiz Silva on 09/02/2010.
|
7
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <map>
|
23
|
+
#include <zxing/ResultPoint.h>
|
24
|
+
#include <zxing/common/GridSampler.h>
|
25
|
+
#include <zxing/datamatrix/detector/Detector.h>
|
26
|
+
#include <zxing/common/detector/MathUtils.h>
|
27
|
+
#include <zxing/NotFoundException.h>
|
28
|
+
#include <sstream>
|
29
|
+
#include <cstdlib>
|
30
|
+
|
31
|
+
using std::abs;
|
32
|
+
using zxing::Ref;
|
33
|
+
using zxing::BitMatrix;
|
34
|
+
using zxing::ResultPoint;
|
35
|
+
using zxing::DetectorResult;
|
36
|
+
using zxing::PerspectiveTransform;
|
37
|
+
using zxing::NotFoundException;
|
38
|
+
using zxing::datamatrix::Detector;
|
39
|
+
using zxing::datamatrix::ResultPointsAndTransitions;
|
40
|
+
using zxing::common::detector::MathUtils;
|
41
|
+
|
42
|
+
namespace {
|
43
|
+
typedef std::map<Ref<ResultPoint>, int> PointMap;
|
44
|
+
void increment(PointMap& table, Ref<ResultPoint> const& key) {
|
45
|
+
int& value = table[key];
|
46
|
+
value += 1;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
ResultPointsAndTransitions::ResultPointsAndTransitions() {
|
51
|
+
Ref<ResultPoint> ref(new ResultPoint(0, 0));
|
52
|
+
from_ = ref;
|
53
|
+
to_ = ref;
|
54
|
+
transitions_ = 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
ResultPointsAndTransitions::ResultPointsAndTransitions(Ref<ResultPoint> from, Ref<ResultPoint> to,
|
58
|
+
int transitions)
|
59
|
+
: to_(to), from_(from), transitions_(transitions) {
|
60
|
+
}
|
61
|
+
|
62
|
+
Ref<ResultPoint> ResultPointsAndTransitions::getFrom() {
|
63
|
+
return from_;
|
64
|
+
}
|
65
|
+
|
66
|
+
Ref<ResultPoint> ResultPointsAndTransitions::getTo() {
|
67
|
+
return to_;
|
68
|
+
}
|
69
|
+
|
70
|
+
int ResultPointsAndTransitions::getTransitions() {
|
71
|
+
return transitions_;
|
72
|
+
}
|
73
|
+
|
74
|
+
Detector::Detector(Ref<BitMatrix> image)
|
75
|
+
: image_(image) {
|
76
|
+
}
|
77
|
+
|
78
|
+
Ref<BitMatrix> Detector::getImage() {
|
79
|
+
return image_;
|
80
|
+
}
|
81
|
+
|
82
|
+
Ref<DetectorResult> Detector::detect() {
|
83
|
+
Ref<WhiteRectangleDetector> rectangleDetector_(new WhiteRectangleDetector(image_));
|
84
|
+
std::vector<Ref<ResultPoint> > ResultPoints = rectangleDetector_->detect();
|
85
|
+
Ref<ResultPoint> pointA = ResultPoints[0];
|
86
|
+
Ref<ResultPoint> pointB = ResultPoints[1];
|
87
|
+
Ref<ResultPoint> pointC = ResultPoints[2];
|
88
|
+
Ref<ResultPoint> pointD = ResultPoints[3];
|
89
|
+
|
90
|
+
// Point A and D are across the diagonal from one another,
|
91
|
+
// as are B and C. Figure out which are the solid black lines
|
92
|
+
// by counting transitions
|
93
|
+
std::vector<Ref<ResultPointsAndTransitions> > transitions(4);
|
94
|
+
transitions[0].reset(transitionsBetween(pointA, pointB));
|
95
|
+
transitions[1].reset(transitionsBetween(pointA, pointC));
|
96
|
+
transitions[2].reset(transitionsBetween(pointB, pointD));
|
97
|
+
transitions[3].reset(transitionsBetween(pointC, pointD));
|
98
|
+
insertionSort(transitions);
|
99
|
+
|
100
|
+
// Sort by number of transitions. First two will be the two solid sides; last two
|
101
|
+
// will be the two alternating black/white sides
|
102
|
+
Ref<ResultPointsAndTransitions> lSideOne(transitions[0]);
|
103
|
+
Ref<ResultPointsAndTransitions> lSideTwo(transitions[1]);
|
104
|
+
|
105
|
+
// Figure out which point is their intersection by tallying up the number of times we see the
|
106
|
+
// endpoints in the four endpoints. One will show up twice.
|
107
|
+
typedef std::map<Ref<ResultPoint>, int> PointMap;
|
108
|
+
PointMap pointCount;
|
109
|
+
increment(pointCount, lSideOne->getFrom());
|
110
|
+
increment(pointCount, lSideOne->getTo());
|
111
|
+
increment(pointCount, lSideTwo->getFrom());
|
112
|
+
increment(pointCount, lSideTwo->getTo());
|
113
|
+
|
114
|
+
// Figure out which point is their intersection by tallying up the number of times we see the
|
115
|
+
// endpoints in the four endpoints. One will show up twice.
|
116
|
+
Ref<ResultPoint> maybeTopLeft;
|
117
|
+
Ref<ResultPoint> bottomLeft;
|
118
|
+
Ref<ResultPoint> maybeBottomRight;
|
119
|
+
for (PointMap::const_iterator entry = pointCount.begin(), end = pointCount.end(); entry != end; ++entry) {
|
120
|
+
Ref<ResultPoint> const& point = entry->first;
|
121
|
+
int value = entry->second;
|
122
|
+
if (value == 2) {
|
123
|
+
bottomLeft = point; // this is definitely the bottom left, then -- end of two L sides
|
124
|
+
} else {
|
125
|
+
// Otherwise it's either top left or bottom right -- just assign the two arbitrarily now
|
126
|
+
if (maybeTopLeft == 0) {
|
127
|
+
maybeTopLeft = point;
|
128
|
+
} else {
|
129
|
+
maybeBottomRight = point;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
if (maybeTopLeft == 0 || bottomLeft == 0 || maybeBottomRight == 0) {
|
135
|
+
throw NotFoundException();
|
136
|
+
}
|
137
|
+
|
138
|
+
// Bottom left is correct but top left and bottom right might be switched
|
139
|
+
std::vector<Ref<ResultPoint> > corners(3);
|
140
|
+
corners[0].reset(maybeTopLeft);
|
141
|
+
corners[1].reset(bottomLeft);
|
142
|
+
corners[2].reset(maybeBottomRight);
|
143
|
+
|
144
|
+
// Use the dot product trick to sort them out
|
145
|
+
ResultPoint::orderBestPatterns(corners);
|
146
|
+
|
147
|
+
// Now we know which is which:
|
148
|
+
Ref<ResultPoint> bottomRight(corners[0]);
|
149
|
+
bottomLeft = corners[1];
|
150
|
+
Ref<ResultPoint> topLeft(corners[2]);
|
151
|
+
|
152
|
+
// Which point didn't we find in relation to the "L" sides? that's the top right corner
|
153
|
+
Ref<ResultPoint> topRight;
|
154
|
+
if (!(pointA->equals(bottomRight) || pointA->equals(bottomLeft) || pointA->equals(topLeft))) {
|
155
|
+
topRight = pointA;
|
156
|
+
} else if (!(pointB->equals(bottomRight) || pointB->equals(bottomLeft)
|
157
|
+
|| pointB->equals(topLeft))) {
|
158
|
+
topRight = pointB;
|
159
|
+
} else if (!(pointC->equals(bottomRight) || pointC->equals(bottomLeft)
|
160
|
+
|| pointC->equals(topLeft))) {
|
161
|
+
topRight = pointC;
|
162
|
+
} else {
|
163
|
+
topRight = pointD;
|
164
|
+
}
|
165
|
+
|
166
|
+
// Next determine the dimension by tracing along the top or right side and counting black/white
|
167
|
+
// transitions. Since we start inside a black module, we should see a number of transitions
|
168
|
+
// equal to 1 less than the code dimension. Well, actually 2 less, because we are going to
|
169
|
+
// end on a black module:
|
170
|
+
|
171
|
+
// The top right point is actually the corner of a module, which is one of the two black modules
|
172
|
+
// adjacent to the white module at the top right. Tracing to that corner from either the top left
|
173
|
+
// or bottom right should work here.
|
174
|
+
|
175
|
+
int dimensionTop = transitionsBetween(topLeft, topRight)->getTransitions();
|
176
|
+
int dimensionRight = transitionsBetween(bottomRight, topRight)->getTransitions();
|
177
|
+
|
178
|
+
//dimensionTop++;
|
179
|
+
if ((dimensionTop & 0x01) == 1) {
|
180
|
+
// it can't be odd, so, round... up?
|
181
|
+
dimensionTop++;
|
182
|
+
}
|
183
|
+
dimensionTop += 2;
|
184
|
+
|
185
|
+
//dimensionRight++;
|
186
|
+
if ((dimensionRight & 0x01) == 1) {
|
187
|
+
// it can't be odd, so, round... up?
|
188
|
+
dimensionRight++;
|
189
|
+
}
|
190
|
+
dimensionRight += 2;
|
191
|
+
|
192
|
+
Ref<BitMatrix> bits;
|
193
|
+
Ref<PerspectiveTransform> transform;
|
194
|
+
Ref<ResultPoint> correctedTopRight;
|
195
|
+
|
196
|
+
|
197
|
+
// Rectanguar symbols are 6x16, 6x28, 10x24, 10x32, 14x32, or 14x44. If one dimension is more
|
198
|
+
// than twice the other, it's certainly rectangular, but to cut a bit more slack we accept it as
|
199
|
+
// rectangular if the bigger side is at least 7/4 times the other:
|
200
|
+
if (4 * dimensionTop >= 7 * dimensionRight || 4 * dimensionRight >= 7 * dimensionTop) {
|
201
|
+
// The matrix is rectangular
|
202
|
+
correctedTopRight = correctTopRightRectangular(bottomLeft, bottomRight, topLeft, topRight,
|
203
|
+
dimensionTop, dimensionRight);
|
204
|
+
if (correctedTopRight == NULL) {
|
205
|
+
correctedTopRight = topRight;
|
206
|
+
}
|
207
|
+
|
208
|
+
dimensionTop = transitionsBetween(topLeft, correctedTopRight)->getTransitions();
|
209
|
+
dimensionRight = transitionsBetween(bottomRight, correctedTopRight)->getTransitions();
|
210
|
+
|
211
|
+
if ((dimensionTop & 0x01) == 1) {
|
212
|
+
// it can't be odd, so, round... up?
|
213
|
+
dimensionTop++;
|
214
|
+
}
|
215
|
+
|
216
|
+
if ((dimensionRight & 0x01) == 1) {
|
217
|
+
// it can't be odd, so, round... up?
|
218
|
+
dimensionRight++;
|
219
|
+
}
|
220
|
+
|
221
|
+
transform = createTransform(topLeft, correctedTopRight, bottomLeft, bottomRight, dimensionTop,
|
222
|
+
dimensionRight);
|
223
|
+
bits = sampleGrid(image_, dimensionTop, dimensionRight, transform);
|
224
|
+
|
225
|
+
} else {
|
226
|
+
// The matrix is square
|
227
|
+
int dimension = min(dimensionRight, dimensionTop);
|
228
|
+
|
229
|
+
// correct top right point to match the white module
|
230
|
+
correctedTopRight = correctTopRight(bottomLeft, bottomRight, topLeft, topRight, dimension);
|
231
|
+
if (correctedTopRight == NULL) {
|
232
|
+
correctedTopRight = topRight;
|
233
|
+
}
|
234
|
+
|
235
|
+
// Redetermine the dimension using the corrected top right point
|
236
|
+
int dimensionCorrected = std::max(transitionsBetween(topLeft, correctedTopRight)->getTransitions(),
|
237
|
+
transitionsBetween(bottomRight, correctedTopRight)->getTransitions());
|
238
|
+
dimensionCorrected++;
|
239
|
+
if ((dimensionCorrected & 0x01) == 1) {
|
240
|
+
dimensionCorrected++;
|
241
|
+
}
|
242
|
+
|
243
|
+
transform = createTransform(topLeft, correctedTopRight, bottomLeft, bottomRight,
|
244
|
+
dimensionCorrected, dimensionCorrected);
|
245
|
+
bits = sampleGrid(image_, dimensionCorrected, dimensionCorrected, transform);
|
246
|
+
}
|
247
|
+
|
248
|
+
ArrayRef< Ref<ResultPoint> > points (new Array< Ref<ResultPoint> >(4));
|
249
|
+
points[0].reset(topLeft);
|
250
|
+
points[1].reset(bottomLeft);
|
251
|
+
points[2].reset(correctedTopRight);
|
252
|
+
points[3].reset(bottomRight);
|
253
|
+
Ref<DetectorResult> detectorResult(new DetectorResult(bits, points));
|
254
|
+
return detectorResult;
|
255
|
+
}
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Calculates the position of the white top right module using the output of the rectangle detector
|
259
|
+
* for a rectangular matrix
|
260
|
+
*/
|
261
|
+
Ref<ResultPoint> Detector::correctTopRightRectangular(Ref<ResultPoint> bottomLeft,
|
262
|
+
Ref<ResultPoint> bottomRight, Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight,
|
263
|
+
int dimensionTop, int dimensionRight) {
|
264
|
+
|
265
|
+
float corr = distance(bottomLeft, bottomRight) / (float) dimensionTop;
|
266
|
+
int norm = distance(topLeft, topRight);
|
267
|
+
float cos = (topRight->getX() - topLeft->getX()) / norm;
|
268
|
+
float sin = (topRight->getY() - topLeft->getY()) / norm;
|
269
|
+
|
270
|
+
Ref<ResultPoint> c1(
|
271
|
+
new ResultPoint(topRight->getX() + corr * cos, topRight->getY() + corr * sin));
|
272
|
+
|
273
|
+
corr = distance(bottomLeft, topLeft) / (float) dimensionRight;
|
274
|
+
norm = distance(bottomRight, topRight);
|
275
|
+
cos = (topRight->getX() - bottomRight->getX()) / norm;
|
276
|
+
sin = (topRight->getY() - bottomRight->getY()) / norm;
|
277
|
+
|
278
|
+
Ref<ResultPoint> c2(
|
279
|
+
new ResultPoint(topRight->getX() + corr * cos, topRight->getY() + corr * sin));
|
280
|
+
|
281
|
+
if (!isValid(c1)) {
|
282
|
+
if (isValid(c2)) {
|
283
|
+
return c2;
|
284
|
+
}
|
285
|
+
return Ref<ResultPoint>(NULL);
|
286
|
+
}
|
287
|
+
if (!isValid(c2)) {
|
288
|
+
return c1;
|
289
|
+
}
|
290
|
+
|
291
|
+
int l1 = abs(dimensionTop - transitionsBetween(topLeft, c1)->getTransitions())
|
292
|
+
+ abs(dimensionRight - transitionsBetween(bottomRight, c1)->getTransitions());
|
293
|
+
int l2 = abs(dimensionTop - transitionsBetween(topLeft, c2)->getTransitions())
|
294
|
+
+ abs(dimensionRight - transitionsBetween(bottomRight, c2)->getTransitions());
|
295
|
+
|
296
|
+
return l1 <= l2 ? c1 : c2;
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Calculates the position of the white top right module using the output of the rectangle detector
|
301
|
+
* for a square matrix
|
302
|
+
*/
|
303
|
+
Ref<ResultPoint> Detector::correctTopRight(Ref<ResultPoint> bottomLeft,
|
304
|
+
Ref<ResultPoint> bottomRight, Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight,
|
305
|
+
int dimension) {
|
306
|
+
|
307
|
+
float corr = distance(bottomLeft, bottomRight) / (float) dimension;
|
308
|
+
int norm = distance(topLeft, topRight);
|
309
|
+
float cos = (topRight->getX() - topLeft->getX()) / norm;
|
310
|
+
float sin = (topRight->getY() - topLeft->getY()) / norm;
|
311
|
+
|
312
|
+
Ref<ResultPoint> c1(
|
313
|
+
new ResultPoint(topRight->getX() + corr * cos, topRight->getY() + corr * sin));
|
314
|
+
|
315
|
+
corr = distance(bottomLeft, topLeft) / (float) dimension;
|
316
|
+
norm = distance(bottomRight, topRight);
|
317
|
+
cos = (topRight->getX() - bottomRight->getX()) / norm;
|
318
|
+
sin = (topRight->getY() - bottomRight->getY()) / norm;
|
319
|
+
|
320
|
+
Ref<ResultPoint> c2(
|
321
|
+
new ResultPoint(topRight->getX() + corr * cos, topRight->getY() + corr * sin));
|
322
|
+
|
323
|
+
if (!isValid(c1)) {
|
324
|
+
if (isValid(c2)) {
|
325
|
+
return c2;
|
326
|
+
}
|
327
|
+
return Ref<ResultPoint>(NULL);
|
328
|
+
}
|
329
|
+
if (!isValid(c2)) {
|
330
|
+
return c1;
|
331
|
+
}
|
332
|
+
|
333
|
+
int l1 = abs(
|
334
|
+
transitionsBetween(topLeft, c1)->getTransitions()
|
335
|
+
- transitionsBetween(bottomRight, c1)->getTransitions());
|
336
|
+
int l2 = abs(
|
337
|
+
transitionsBetween(topLeft, c2)->getTransitions()
|
338
|
+
- transitionsBetween(bottomRight, c2)->getTransitions());
|
339
|
+
|
340
|
+
return l1 <= l2 ? c1 : c2;
|
341
|
+
}
|
342
|
+
|
343
|
+
bool Detector::isValid(Ref<ResultPoint> p) {
|
344
|
+
return p->getX() >= 0 && p->getX() < image_->getWidth() && p->getY() > 0
|
345
|
+
&& p->getY() < image_->getHeight();
|
346
|
+
}
|
347
|
+
|
348
|
+
int Detector::distance(Ref<ResultPoint> a, Ref<ResultPoint> b) {
|
349
|
+
return MathUtils::round(ResultPoint::distance(a, b));
|
350
|
+
}
|
351
|
+
|
352
|
+
Ref<ResultPointsAndTransitions> Detector::transitionsBetween(Ref<ResultPoint> from,
|
353
|
+
Ref<ResultPoint> to) {
|
354
|
+
// See QR Code Detector, sizeOfBlackWhiteBlackRun()
|
355
|
+
int fromX = (int) from->getX();
|
356
|
+
int fromY = (int) from->getY();
|
357
|
+
int toX = (int) to->getX();
|
358
|
+
int toY = (int) to->getY();
|
359
|
+
bool steep = abs(toY - fromY) > abs(toX - fromX);
|
360
|
+
if (steep) {
|
361
|
+
int temp = fromX;
|
362
|
+
fromX = fromY;
|
363
|
+
fromY = temp;
|
364
|
+
temp = toX;
|
365
|
+
toX = toY;
|
366
|
+
toY = temp;
|
367
|
+
}
|
368
|
+
|
369
|
+
int dx = abs(toX - fromX);
|
370
|
+
int dy = abs(toY - fromY);
|
371
|
+
int error = -dx >> 1;
|
372
|
+
int ystep = fromY < toY ? 1 : -1;
|
373
|
+
int xstep = fromX < toX ? 1 : -1;
|
374
|
+
int transitions = 0;
|
375
|
+
bool inBlack = image_->get(steep ? fromY : fromX, steep ? fromX : fromY);
|
376
|
+
for (int x = fromX, y = fromY; x != toX; x += xstep) {
|
377
|
+
bool isBlack = image_->get(steep ? y : x, steep ? x : y);
|
378
|
+
if (isBlack != inBlack) {
|
379
|
+
transitions++;
|
380
|
+
inBlack = isBlack;
|
381
|
+
}
|
382
|
+
error += dy;
|
383
|
+
if (error > 0) {
|
384
|
+
if (y == toY) {
|
385
|
+
break;
|
386
|
+
}
|
387
|
+
y += ystep;
|
388
|
+
error -= dx;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
Ref<ResultPointsAndTransitions> result(new ResultPointsAndTransitions(from, to, transitions));
|
392
|
+
return result;
|
393
|
+
}
|
394
|
+
|
395
|
+
Ref<PerspectiveTransform> Detector::createTransform(Ref<ResultPoint> topLeft,
|
396
|
+
Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft, Ref<ResultPoint> bottomRight,
|
397
|
+
int dimensionX, int dimensionY) {
|
398
|
+
|
399
|
+
Ref<PerspectiveTransform> transform(
|
400
|
+
PerspectiveTransform::quadrilateralToQuadrilateral(
|
401
|
+
0.5f,
|
402
|
+
0.5f,
|
403
|
+
dimensionX - 0.5f,
|
404
|
+
0.5f,
|
405
|
+
dimensionX - 0.5f,
|
406
|
+
dimensionY - 0.5f,
|
407
|
+
0.5f,
|
408
|
+
dimensionY - 0.5f,
|
409
|
+
topLeft->getX(),
|
410
|
+
topLeft->getY(),
|
411
|
+
topRight->getX(),
|
412
|
+
topRight->getY(),
|
413
|
+
bottomRight->getX(),
|
414
|
+
bottomRight->getY(),
|
415
|
+
bottomLeft->getX(),
|
416
|
+
bottomLeft->getY()));
|
417
|
+
return transform;
|
418
|
+
}
|
419
|
+
|
420
|
+
Ref<BitMatrix> Detector::sampleGrid(Ref<BitMatrix> image, int dimensionX, int dimensionY,
|
421
|
+
Ref<PerspectiveTransform> transform) {
|
422
|
+
GridSampler &sampler = GridSampler::getInstance();
|
423
|
+
return sampler.sampleGrid(image, dimensionX, dimensionY, transform);
|
424
|
+
}
|
425
|
+
|
426
|
+
void Detector::insertionSort(std::vector<Ref<ResultPointsAndTransitions> > &vector) {
|
427
|
+
int max = vector.size();
|
428
|
+
bool swapped = true;
|
429
|
+
Ref<ResultPointsAndTransitions> value;
|
430
|
+
Ref<ResultPointsAndTransitions> valueB;
|
431
|
+
do {
|
432
|
+
swapped = false;
|
433
|
+
for (int i = 1; i < max; i++) {
|
434
|
+
value = vector[i - 1];
|
435
|
+
if (compare(value, (valueB = vector[i])) > 0){
|
436
|
+
swapped = true;
|
437
|
+
vector[i - 1].reset(valueB);
|
438
|
+
vector[i].reset(value);
|
439
|
+
}
|
440
|
+
}
|
441
|
+
} while (swapped);
|
442
|
+
}
|
443
|
+
|
444
|
+
int Detector::compare(Ref<ResultPointsAndTransitions> a, Ref<ResultPointsAndTransitions> b) {
|
445
|
+
return a->getTransitions() - b->getTransitions();
|
446
|
+
}
|